Initial Commit
This commit is contained in:
Родитель
f5a466616a
Коммит
33f5f3da73
|
@ -0,0 +1,5 @@
|
|||
This CHANGELOG.md file will contain the update log for the latest set of updates to the templates
|
||||
|
||||
# UPDATES for Release 3.7
|
||||
|
||||
1. Created this repository as a central place to store Ansible playbooks that are used.
|
12
README.md
12
README.md
|
@ -1,3 +1,15 @@
|
|||
# OpenShift Container Platform Playbooks Used by Deployment templates
|
||||
|
||||
## NOTE: Deployment Template: [aka.ms/OpenShift](http://aka.ms/OpenShift)
|
||||
|
||||
The master branch will now contain the most current release of OpenShift Container Platform with experimental items. This may cause instability but will include new things or try new things.
|
||||
|
||||
We will now have branches for the stable releases:
|
||||
- Release-3.6
|
||||
- Release-3.7
|
||||
- etc.
|
||||
|
||||
|
||||
|
||||
# Contributing
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- hosts: masters
|
||||
gather_facts: no
|
||||
remote_user: "{{ lookup('env','SUDOUSER') }}"
|
||||
become: yes
|
||||
become_method: sudo
|
||||
vars:
|
||||
description: "Create initial OpenShift user"
|
||||
tasks:
|
||||
- name: create directory
|
||||
file: path=/etc/origin/master state=directory
|
||||
- name: add initial OpenShift user
|
||||
shell: "htpasswd -cb /etc/origin/master/htpasswd {{ lookup('env','SUDOUSER') }} \"{{ lookup('env','PASSWORD') }}\""
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- hosts: master0
|
||||
gather_facts: no
|
||||
remote_user: "{{ lookup('env','SUDOUSER') }}"
|
||||
become: yes
|
||||
become_method: sudo
|
||||
vars:
|
||||
description: "Make user cluster admin"
|
||||
tasks:
|
||||
- name: make OpenShift user cluster admin
|
||||
shell: "oadm policy add-cluster-role-to-user cluster-admin {{ lookup('env','SUDOUSER') }} --config=/etc/origin/master/admin.kubeconfig"
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- hosts: nodes
|
||||
gather_facts: no
|
||||
remote_user: "{{ lookup('env','SUDOUSER') }}"
|
||||
become: yes
|
||||
become_method: sudo
|
||||
vars:
|
||||
description: "Set password for Cockpit"
|
||||
tasks:
|
||||
- name: configure Cockpit password
|
||||
shell: echo \"{{ lookup('env','PASSWORD') }}\"|passwd root --stdin
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- hosts: master0
|
||||
gather_facts: no
|
||||
remote_user: "{{ lookup('env','SUDOUSER') }}"
|
||||
become: yes
|
||||
become_method: sudo
|
||||
vars:
|
||||
description: "Create Storage Class"
|
||||
storage: "{{ lookup('env','STORAGEKIND') }}"
|
||||
tasks:
|
||||
- name: Create unmanaged storage class
|
||||
shell: oc create -f /home/{{ lookup('env','SUDOUSER') }}/scunmanaged.yml
|
||||
when: storage == 'unmanaged'
|
||||
|
||||
- name: Create managed storage class
|
||||
shell: oc create -f /home/{{ lookup('env','SUDOUSER') }}/scmanaged.yml
|
||||
when: storage == 'managed'
|
|
@ -0,0 +1,8 @@
|
|||
- hosts: masters
|
||||
gather_facts: no
|
||||
become: yes
|
||||
vars:
|
||||
description: "Reset Masters to non-schedulable"
|
||||
tasks:
|
||||
- name: set masters as unschedulable
|
||||
command: oadm manage-node {{inventory_hostname}} --schedulable=false
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- hosts: master0
|
||||
gather_facts: no
|
||||
remote_user: "{{ lookup('env','SUDOUSER') }}"
|
||||
become: yes
|
||||
become_method: sudo
|
||||
vars:
|
||||
description: "Set registry to use Azure Storage"
|
||||
tasks:
|
||||
- name: Configure docker-registry to use Azure Storage
|
||||
shell: oc env dc docker-registry -e REGISTRY_STORAGE=azure -e REGISTRY_STORAGE_AZURE_ACCOUNTNAME=$REGISTRYSA -e REGISTRY_STORAGE_AZURE_ACCOUNTKEY=$ACCOUNTKEY -e REGISTRY_STORAGE_AZURE_CONTAINER=registry -e REGISTRY_STORAGE_AZURE_REALM=core.usgovcloudapi.net
|
|
@ -0,0 +1,11 @@
|
|||
--
|
||||
- hosts: master0
|
||||
gather_facts: no
|
||||
remote_user: "{{ lookup('env','SUDOUSER') }}"
|
||||
become: yes
|
||||
become_method: sudo
|
||||
vars:
|
||||
description: "Set registry to use Azure Storage"
|
||||
tasks:
|
||||
- name: Configure docker-registry to use Azure Storage
|
||||
shell: oc env dc docker-registry -e REGISTRY_STORAGE=azure -e REGISTRY_STORAGE_AZURE_ACCOUNTNAME=$REGISTRYSA -e REGISTRY_STORAGE_AZURE_ACCOUNTKEY=$ACCOUNTKEY -e REGISTRY_STORAGE_AZURE_CONTAINER=registry
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- hosts: masters
|
||||
gather_facts: no
|
||||
become: yes
|
||||
become_method: sudo
|
||||
tasks:
|
||||
- name: Reboot master nodes
|
||||
shell: (/bin/sleep 5 ; shutdown -r now "OpenShift configurations required reboot" ) &
|
||||
async: 30
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
|
||||
- name: Wait for master nodes to reboot
|
||||
wait_for:
|
||||
port: 22
|
||||
host: "{{ ansible_ssh_host|default(inventory_hostname) }}"
|
||||
delay: 10
|
||||
timeout: 180
|
||||
connection: local
|
||||
become: false
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- hosts: nodes:!masters
|
||||
gather_facts: no
|
||||
become: yes
|
||||
become_method: sudo
|
||||
tasks:
|
||||
- name: Reboot infra and app nodes
|
||||
shell: (/bin/sleep 5 ; shutdown -r now "OpenShift configurations required reboot" ) &
|
||||
async: 30
|
||||
poll: 0
|
||||
ignore_errors: true
|
||||
|
||||
- name: Wait for infra and app nodes to reboot
|
||||
wait_for:
|
||||
port: 22
|
||||
host: "{{ ansible_ssh_host|default(inventory_hostname) }}"
|
||||
delay: 10
|
||||
timeout: 180
|
||||
connection: local
|
||||
become: false
|
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
- hosts: masters
|
||||
gather_facts: no
|
||||
serial: 1
|
||||
become: yes
|
||||
vars:
|
||||
azure_conf_dir: /etc/azure
|
||||
azure_conf: "{{ azure_conf_dir }}/azure.conf"
|
||||
master_conf: /etc/origin/master/master-config.yaml
|
||||
handlers:
|
||||
- name: restart atomic-openshift-master-api
|
||||
systemd:
|
||||
state: restarted
|
||||
name: atomic-openshift-master-api
|
||||
|
||||
- name: restart atomic-openshift-master-controllers
|
||||
systemd:
|
||||
state: restarted
|
||||
name: atomic-openshift-master-controllers
|
||||
|
||||
post_tasks:
|
||||
- name: make sure /etc/azure exists
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ azure_conf_dir }}"
|
||||
|
||||
- name: populate /etc/azure/azure.conf
|
||||
copy:
|
||||
dest: "{{ azure_conf }}"
|
||||
content: |
|
||||
{
|
||||
"aadClientId": "{{ lookup('env','AADCLIENTID') }}",
|
||||
"aadClientSecret": "{{ lookup('env','AADCLIENTSECRET') }}",
|
||||
"aadTenantId": "{{ lookup('env','TENANTID') }}",
|
||||
"subscriptionId": "{{ lookup('env','SUBSCRIPTIONID') }}",
|
||||
"tenantId": "{{ lookup('env','TENANTID') }}",
|
||||
"resourceGroup": "{{ lookup('env','RESOURCEGROUP') }}",
|
||||
"location": "{{ lookup('env','LOCATION') }}",
|
||||
"cloud": "{{ lookup('env','CLOUDNAME')}}"
|
||||
}
|
||||
notify:
|
||||
- restart atomic-openshift-master-api
|
||||
- restart atomic-openshift-master-controllers
|
||||
|
||||
- name: insert the azure disk config into the master
|
||||
modify_yaml:
|
||||
dest: "{{ master_conf }}"
|
||||
yaml_key: "{{ item.key }}"
|
||||
yaml_value: "{{ item.value }}"
|
||||
with_items:
|
||||
- key: kubernetesMasterConfig.apiServerArguments.cloud-config
|
||||
value:
|
||||
- "{{ azure_conf }}"
|
||||
|
||||
- key: kubernetesMasterConfig.apiServerArguments.cloud-provider
|
||||
value:
|
||||
- azure
|
||||
|
||||
- key: kubernetesMasterConfig.controllerArguments.cloud-config
|
||||
value:
|
||||
- "{{ azure_conf }}"
|
||||
|
||||
- key: kubernetesMasterConfig.controllerArguments.cloud-provider
|
||||
value:
|
||||
- azure
|
||||
notify:
|
||||
- restart atomic-openshift-master-api
|
||||
- restart atomic-openshift-master-controllers
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
- hosts: masters
|
||||
serial: 1
|
||||
gather_facts: no
|
||||
become: yes
|
||||
vars:
|
||||
azure_conf_dir: /etc/azure
|
||||
azure_conf: "{{ azure_conf_dir }}/azure.conf"
|
||||
node_conf: /etc/origin/node/node-config.yaml
|
||||
handlers:
|
||||
- name: restart atomic-openshift-node
|
||||
systemd:
|
||||
state: restarted
|
||||
name: atomic-openshift-node
|
||||
post_tasks:
|
||||
- name: make sure /etc/azure exists
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ azure_conf_dir }}"
|
||||
|
||||
- name: populate /etc/azure/azure.conf
|
||||
copy:
|
||||
dest: "{{ azure_conf }}"
|
||||
content: |
|
||||
{
|
||||
"aadClientId": "{{ lookup('env','AADCLIENTID') }}",
|
||||
"aadClientSecret": "{{ lookup('env','AADCLIENTSECRET') }}",
|
||||
"aadTenantId": "{{ lookup('env','TENANTID') }}",
|
||||
"subscriptionId": "{{ lookup('env','SUBSCRIPTIONID') }}",
|
||||
"tenantId": "{{ lookup('env','TENANTID') }}",
|
||||
"resourceGroup": "{{ lookup('env','RESOURCEGROUP') }}",
|
||||
"location": "{{ lookup('env','LOCATION') }}",
|
||||
"cloud": "{{ lookup('env','CLOUDNAME') }}"
|
||||
}
|
||||
notify:
|
||||
- restart atomic-openshift-node
|
||||
- name: insert the azure disk config into the node
|
||||
modify_yaml:
|
||||
dest: "{{ node_conf }}"
|
||||
yaml_key: "{{ item.key }}"
|
||||
yaml_value: "{{ item.value }}"
|
||||
with_items:
|
||||
- key: kubeletArguments.cloud-config
|
||||
value:
|
||||
- "{{ azure_conf }}"
|
||||
|
||||
- key: kubeletArguments.cloud-provider
|
||||
value:
|
||||
- azure
|
||||
notify:
|
||||
- restart atomic-openshift-node
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
- hosts: nodes:!masters
|
||||
serial: 1
|
||||
gather_facts: no
|
||||
become: yes
|
||||
vars:
|
||||
azure_conf_dir: /etc/azure
|
||||
azure_conf: "{{ azure_conf_dir }}/azure.conf"
|
||||
node_conf: /etc/origin/node/node-config.yaml
|
||||
handlers:
|
||||
- name: restart atomic-openshift-node
|
||||
systemd:
|
||||
state: restarted
|
||||
name: atomic-openshift-node
|
||||
post_tasks:
|
||||
- name: make sure /etc/azure exists
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ azure_conf_dir }}"
|
||||
|
||||
- name: populate /etc/azure/azure.conf
|
||||
copy:
|
||||
dest: "{{ azure_conf }}"
|
||||
content: |
|
||||
{
|
||||
"aadClientId": "{{ lookup('env','AADCLIENTID') }}",
|
||||
"aadClientSecret": "{{ lookup('env','AADCLIENTSECRET') }}",
|
||||
"aadTenantId": "{{ lookup('env','TENANTID') }}",
|
||||
"subscriptionId": "{{ lookup('env','SUBSCRIPTIONID') }}",
|
||||
"tenantId": "{{ lookup('env','TENANTID') }}",
|
||||
"resourceGroup": "{{ lookup('env','RESOURCEGROUP') }}",
|
||||
"location": "{{ lookup('env','LOCATION') }}",
|
||||
"cloud": "{{ lookup('env','CLOUDNAME')}}"
|
||||
}
|
||||
notify:
|
||||
- restart atomic-openshift-node
|
||||
- name: insert the azure disk config into the node
|
||||
modify_yaml:
|
||||
dest: "{{ node_conf }}"
|
||||
yaml_key: "{{ item.key }}"
|
||||
yaml_value: "{{ item.value }}"
|
||||
with_items:
|
||||
- key: kubeletArguments.cloud-config
|
||||
value:
|
||||
- "{{ azure_conf }}"
|
||||
|
||||
- key: kubeletArguments.cloud-provider
|
||||
value:
|
||||
- azure
|
||||
notify:
|
||||
- restart atomic-openshift-node
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- lineinfile:
|
||||
dest: /etc/ansible/ansible.cfg
|
||||
regexp: '^library '
|
||||
insertafter: '#library = /usr/share/my_modules/'
|
||||
line: 'library = /usr/share/ansible/openshift-ansible/library/'
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- lineinfile:
|
||||
dest: /etc/ansible/hosts
|
||||
insertafter: '[new_nodes]'
|
||||
line: "$INFRA openshift_node_labels=\"{'type': 'infra', 'zone': 'default'}\" openshift_hostname=$INFRA"
|
||||
regexp: '^$INFRA '
|
||||
state: present
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- lineinfile:
|
||||
dest: /etc/ansible/hosts
|
||||
insertafter: '[new_nodes]'
|
||||
line: "$NODE openshift_node_labels=\"{'type': 'app', 'zone': 'default'}\" openshift_hostname=$NODE"
|
||||
regexp: '^$NODE '
|
||||
state: present
|
Загрузка…
Ссылка в новой задаче