Skip to content

Commit

Permalink
fix: Adjust boolean code style (#110)
Browse files Browse the repository at this point in the history
Signed-off-by: Klaus Smolin <smolin@de.ibm.com>
  • Loading branch information
smolin-de committed Apr 10, 2023
1 parent cdd52fe commit e7973d7
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 48 deletions.
10 changes: 5 additions & 5 deletions playbooks/0_setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
- hosts: localhost
tags: localhost
connection: local
become: False
gather_facts: True
become: false
gather_facts: true
roles:
- set_inventory

Expand Down Expand Up @@ -54,8 +54,8 @@

- hosts: localhost
connection: local
become: False
gather_facts: True
become: false
gather_facts: true
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
vars:
Expand All @@ -65,4 +65,4 @@
- install_packages
- ssh_key_gen
- ssh_agent
- ssh_copy_id #to file server
- ssh_copy_id #to file server
8 changes: 4 additions & 4 deletions playbooks/2_create_kvm_host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
tags: update_cfgs, update, kvm_host_2
become: false
gather_facts: false
vars_files:
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
tasks:
- name: Include vars for a second KVM host if it is to be created.
Expand All @@ -38,7 +38,7 @@
tags: update_cfgs, update, kvm_host_3
become: false
gather_facts: false
vars_files:
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
tasks:
- name: Include vars for third KVM host if it is to be created.
Expand Down Expand Up @@ -90,8 +90,8 @@
include_vars:
file: "{{ inventory_dir }}/host_vars/{{ env.z.lpar3.hostname }}.yaml"
when: env.z.lpar3.create == True

- name: Boot and install RHEL for a third KVM host.
import_role:
name: create_kvm_host
when: env.z.lpar3.create == True
when: env.z.lpar3.create == True
13 changes: 6 additions & 7 deletions playbooks/3_setup_kvm_host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
connection: local
become: false
gather_facts: true
vars_files:
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
vars:
ssh_target: ["{{ env.z.lpar1.ip }}","{{ env.z.lpar1.user }}","{{ env.z.lpar1.pass }}","{{ path_to_key_pair }}"]
Expand All @@ -25,7 +25,7 @@
connection: local
become: false
gather_facts: false
vars_files:
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
vars:
ssh_target: ["{{ env.z.lpar2.ip }}","{{ env.z.lpar2.user }}","{{ env.z.lpar2.pass }}","{{ path_to_key_pair }}"]
Expand All @@ -47,7 +47,7 @@
connection: local
become: false
gather_facts: false
vars_files:
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
vars:
ssh_target: ["{{ env.z.lpar3.ip }}","{{ env.z.lpar3.user }}","{{ env.z.lpar3.pass }}","{{ path_to_key_pair }}"]
Expand All @@ -68,7 +68,7 @@
tags: setup, section_2
gather_facts: true
become: true
vars:
vars:
packages: "{{ env.pkgs.kvm }}"
roles:
- { role: attach_subscription, when: env.redhat.username is defined and env.redhat.password is defined }
Expand Down Expand Up @@ -124,7 +124,7 @@
loop:
- /etc/libvirt/qemu.conf
- "/home/{{ ansible_user }}/.config/libvirt/libvirt.conf"
- /etc/libvirt/libvirt.conf
- /etc/libvirt/libvirt.conf

- name: Ensure KVM admin user is part of groups 'kvm', 'libvirt'.
tags: groups, group, libvirt
Expand Down Expand Up @@ -160,12 +160,11 @@
sysctl_set: true
state: present
reload: true
when: env.network_mode | upper == 'NAT'
when: env.network_mode | upper == 'NAT'

- hosts: kvm_host
tags: setup, section_3
become: true
roles:
- configure_storage
- { role: macvtap, when: env.network_mode | upper != 'NAT' }

10 changes: 5 additions & 5 deletions playbooks/5_setup_bastion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
- name: 5 setup bastion - configure bastion node with essential services
hosts: bastion
tags: services, section_2
become: True
become: true
vars:
packages: "{{ env.pkgs.bastion }}"
vars_files:
Expand All @@ -80,7 +80,7 @@

- hosts: bastion
tags: services, section_2, openvpn
become: True
become: true
vars:
openvpn_role: "server"
roles:
Expand Down Expand Up @@ -119,8 +119,8 @@
- name: setup OpenVPN on KVM host(s).
hosts: kvm_host
tags: services, section_3, openvpn
become: True
gather_facts: False
become: true
gather_facts: false
vars:
openvpn_role: "client"
openvpn_client_server: "{{ env.bastion.networking.ip }}"
Expand Down Expand Up @@ -169,7 +169,7 @@

- hosts: bastion
tags: get_ocp, section_3
become: True
become: true
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
roles:
Expand Down
6 changes: 3 additions & 3 deletions playbooks/6_create_nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

- name: 6 create nodes - wait for bootstrap to connect control plane (for non-root user)
hosts: bastion
become: True
become: true
environment:
KUBECONFIG: "/home/{{ env.bastion.access.user }}/.kube/config"
gather_facts: true
Expand All @@ -38,7 +38,7 @@

- name: 6 create nodes - wait for bootstrap to connect to control plane (for root user)
hosts: bastion
become: True
become: true
environment:
KUBECONFIG: "/{{ env.bastion.access.user }}/.kube/config"
gather_facts: true
Expand All @@ -50,7 +50,7 @@
- name: 6 create nodes - once bootstrapping is complete, tear down bootstrap.
hosts: kvm_host[-1]
tags: create_nodes, teardown_bootstrap
gather_facts: False
gather_facts: false
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
tasks:
Expand Down
2 changes: 1 addition & 1 deletion playbooks/pre-existing_site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
- import_playbook: 4_create_bastion.yaml
- import_playbook: 5_setup_bastion.yaml
- import_playbook: 6_create_nodes.yaml
- import_playbook: 7_ocp_verification.yaml
- import_playbook: 7_ocp_verification.yaml
1 change: 0 additions & 1 deletion roles/create_bastion/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Create a directory on the KVM host server for bastion configuration files
become: false
tags: create_bastion
Expand Down
31 changes: 15 additions & 16 deletions roles/get_ocp/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Delete ignition folder for idempotency
tags: get_ocp
file:
Expand All @@ -12,7 +11,7 @@
file:
path: /var/www/html/bin
state: directory
mode: '0755'
mode: "0755"
owner: "root"
group: "root"

Expand All @@ -34,7 +33,7 @@
get_url:
url: "https://mirror.openshift.com/pub/openshift-v{{ env.openshift.version | string | split('.') | first }}/{{ env.install_config.control.architecture }}/dependencies/rhcos/{{ ( env.openshift.version | string | split('.') )[:-1] | join('.') }}/{{ env.openshift.version }}/rhcos-live-rootfs.{{ env.install_config.control.architecture }}.img"
dest: "/var/www/html/bin/rhcos-live-rootfs-{{ env.openshift.version }}-{{ env.install_config.control.architecture }}.img"
mode: '0644'
mode: "0644"

- name: Unzip OCP client and installer
tags: get_ocp
Expand All @@ -54,7 +53,7 @@
dest: /usr/sbin/{{ item }}
owner: root
group: root
mode: '755'
mode: "755"
remote_src: yes
loop:
- kubectl
Expand Down Expand Up @@ -97,8 +96,8 @@
become: true
replace:
path: /root/ocpinst/manifests/cluster-scheduler-02-config.yml
regexp: ': true'
replace: ': false'
regexp: ": true"
replace: ": false"

- name: Set permissions for ocpinst directory contents to root
tags: get_ocp
Expand Down Expand Up @@ -134,24 +133,24 @@
group: root
mode: "{{ item.mode }}"
loop:
- { state: file, path: bootstrap.ign, mode: '755' }
- { state: file, path: master.ign, mode: '755' }
- { state: file, path: worker.ign, mode: '755' }
- { state: directory, path: auth, mode: '755' }
- { state: file, path: metadata.json, mode: '755' }
- { state: file, path: auth/kubeconfig, mode: '644' }
- { state: file, path: auth/kubeadmin-password, mode: '644' }
- { state: file, path: bootstrap.ign, mode: "755" }
- { state: file, path: master.ign, mode: "755" }
- { state: file, path: worker.ign, mode: "755" }
- { state: directory, path: auth, mode: "755" }
- { state: file, path: metadata.json, mode: "755" }
- { state: file, path: auth/kubeconfig, mode: "644" }
- { state: file, path: auth/kubeadmin-password, mode: "644" }

- name: Create directory in admin user's home for default kubeconfig.
tags: get_ocp, config
become: False
become: false
file:
state: directory
path: ~/.kube

- name: Create directory in root's home for default kubeconfig.
tags: get_ocp, config
become: True
become: true
file:
state: directory
path: ~/.kube
Expand Down Expand Up @@ -199,7 +198,7 @@
src: /root/ocpinst/{{ item }}.ign
dest: /var/www/html/ignition
remote_src: yes
mode: '775'
mode: "775"
group: root
owner: root
loop:
Expand Down
5 changes: 2 additions & 3 deletions roles/install_packages/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---

- name: Print the list of packages to be installed and updated.
tags: install_packages
debug:
var: packages

- name: Installing required packages for Linux machines.
tags: install_packages
become: True
become: true
ansible.builtin.package:
name: "{{ item }}"
state: latest
Expand All @@ -17,7 +16,7 @@

- name: Installing required packages for Mac machines.
tags: install_packages
become: False
become: false
community.general.homebrew:
name: "{{ item }}"
state: latest
Expand Down
5 changes: 2 additions & 3 deletions roles/wait_for_install_complete/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Almost there! Add host info to /etc/hosts so you can login to the cluster via web browser. Ansible Controller sudo password required
tags: wait_for_install_complete
become: true
Expand Down Expand Up @@ -27,15 +26,15 @@

- name: "Additional step, if using NAT"
tags: wait_for_install_complete
debug:
debug:
msg: "NAT USERS ONLY: Create SSH tunnel to cluster, i.e run command in terminal window from controller: 'sshuttle -r {{ env.bastion.access.user }}@{{ env.bastion.networking.ip }} 192.168.122.0/15 --dns'"
when: ( env.network_mode | upper == "NAT" )
changed_when: false

- name: Congratulations! OpenShift installation complete. Use the information below for first-time login via web browser.
tags: wait_for_install_complete
command: "echo {{ item }}"
loop:
loop:
- " URL: {{ ocp_url }} "
- " Username: kubeadmin "
- " Password: {{ ocp_passwd.stdout }} "
Expand Down

0 comments on commit e7973d7

Please sign in to comment.