Skip to content

Instantly share code, notes, and snippets.

View jc1518's full-sized avatar
🐶

Jackie Chen jc1518

🐶
View GitHub Profile
@jc1518
jc1518 / a3.py
Created July 30, 2020 05:42
Automate Atlassian Addons POC
# a3 = Automate Atlassian Addons
def get_server_info(server, auth):
''' Check application version on the server '''
print("\n>>> Checking server information")
server_application = server.split('.')[0].split('-')[0]
url = "https://{}/rest/applinks/1.0/manifest".format(server)
headers = {'content-type': 'application/xml'}
response = requests.get(url, auth=auth, headers=headers)
response.raise_for_status()
---
- name: Check if this is a new cluster that has not been initialized
stat:
path: "{{ atl_product_home_shared }}/export/indexsnapshots"
register: snapshotfolder
- name: Remove offline jira nodes from clusternode table
postgresql_query:
login_host: "{{ atl_db_host }}"
---
atl_db_root_password: "{{ (lookup('aws_secret', '/jira/database/master', region='ap-southeast-2')| from_json).get('password') }}"
current_epoch_time_sec: "{{ ansible_date_time.epoch }}"
delete_threshold_hours: '24'
@jc1518
jc1518 / accounts.yaml
Created January 17, 2020 04:09
Ansbile playbook sample - get dictionary value
---
- hosts: localhost
vars:
accounts:
dev:
account: 123
contact: Jackie@123.com
uat:
account: 456
@jc1518
jc1518 / k8s_jira_service_sticky_session.yaml
Created November 6, 2019 00:11
Jira service with stick sessions config file on k8s
---
apiVersion: v1
kind: Service
metadata:
name: jira
labels:
app: jira
annotations:
traefik.ingress.kubernetes.io/affinity: "true"
traefik.ingress.kubernetes.io/session-cookie-name: "sticky"
@jc1518
jc1518 / traefik_ingress_sample.yaml
Created November 5, 2019 23:59
Ingress config file sample
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sandbox
namespace: default
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
@jc1518
jc1518 / resize_pv_sample
Last active November 5, 2019 05:58
Resize persistent volume on k8s
$ kubectl describe sc glusterfs
Name: glusterfs
IsDefaultClass: Yes
Annotations: kubectl.kubernetes.io/last-applied-configuration={"allowVolumeExpansion":true,"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{},"name":"glusterfs"},"parameters":{"resturl":"http://xxx.xxx.xxx.xxx:8080","volumetype":"none"},"provisioner":"kubernetes.io/glusterfs"}
,storageclass.kubernetes.io/is-default-class=true
Provisioner: kubernetes.io/glusterfs
Parameters: resturl=http://xxx.xxx.xxx.xxx:8080,volumetype=none
AllowVolumeExpansion: True
MountOptions: <none>
ReclaimPolicy: Delete
@jc1518
jc1518 / k8s_jira_postgres_service.yaml
Created November 3, 2019 23:33
Jira Postgres DB service config file on k8s
---
apiVersion: v1
kind: Service
metadata:
name: jira-postgres
labels:
app: jira-postgres
spec:
type: ClusterIP
ports:
@jc1518
jc1518 / k8s_jira_postgres_deployment.yaml
Created November 3, 2019 23:31
Jira Postgres DB deployment config file on k8s
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jira-postgres
labels:
app: jira-postgres
spec:
replicas: 1
selector:
@jc1518
jc1518 / k8s_jira_postgres_pv.yaml
Created November 3, 2019 23:29
Jira Postgres DB persistent volume config file on k8s
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: jira-postgres-pvc
labels:
app: jira-postgres
spec:
accessModes:
- ReadWriteOnce