Bläddra i källkod

More careful facts

Zach Isbach 4 år sedan
förälder
incheckning
845ae53551

+ 5 - 9
roles/ec2_hosts/tasks/main.yml

@@ -6,8 +6,12 @@
   delegate_to: localhost
   become: false
 
-- name: Extract IPs and tag names
+- name: Combine
   set_fact:
+    ec2_hosts: "{{ dict(ec2_hosts_tags | zip(ec2_hosts_ips)) }}"
+    ec2_hosts_v6: "{{ dict(ec2_hosts_tags | zip(ec2_hosts_ips_v6)) }}"
+    ec2_hosts_local: "{{ dict(ec2_hosts_tags | zip(ec2_hosts_ips_local)) }}"
+  vars:
     ec2_hosts_tags: "{{
       ec2_hosts_instances |
       community.general.json_query('instances[*].tags') |
@@ -27,11 +31,3 @@
     }}"
   delegate_to: localhost
   become: false
-
-- name: Combine
-  set_fact:
-    ec2_hosts: "{{ dict(ec2_hosts_tags | zip(ec2_hosts_ips)) }}"
-    ec2_hosts_v6: "{{ dict(ec2_hosts_tags | zip(ec2_hosts_ips_v6)) }}"
-    ec2_hosts_local: "{{ dict(ec2_hosts_tags | zip(ec2_hosts_ips_local)) }}"
-  delegate_to: localhost
-  become: false

+ 2 - 1
roles/gluster_lvm_vol/defaults/main.yml

@@ -2,4 +2,5 @@ glutser_lvm_vol_vg: gluster
 gluster_lvm_vol_size: 1G
 gluster_lvm_vol_dev: "/dev/mapper/{{ gluster_lvm_vol_vg }}-{{ gluster_lvm_vol_name }}"
 gluster_lvm_vol_group: "{{ gluster_lvm_vol_name }}"
-gluster_lvm_vol_cluster: "{{ groups[ gluster_lvm_vol_vg ] }}"
+gluster_lvm_vol_cluster: "{{ groups[ gluster_lvm_vol_vg ] }}"
+gluster_lvm_vol_perms: '0770'

+ 2 - 1
roles/gluster_lvm_vol/tasks/main.yml

@@ -1,4 +1,4 @@
-- name: Check group {{ gluster_lvm_vol_group }}
+- name: "Check group {{ gluster_lvm_vol_group }}"
   include_role:
     name: add_group
   vars:
@@ -19,4 +19,5 @@
     gluster_vol_cluster: "{{ gluster_lvm_vol_cluster }}"
     gluster_vol_name: "{{ gluster_lvm_vol_name }}"
     gluster_vol_dev: "{{ gluster_lvm_vol_dev }}"
+    gluster_vol_perms: "{{ gluster_lvm_vol_perms }}"
     gluster_vol_ssl_allow: "{{ gluster_lvm_vol_sslallow | default(omit) }}"

+ 7 - 6
roles/gluster_vol/handlers/main.yml

@@ -1,21 +1,22 @@
-- name: Check if {{ gluster_vol_name }} is running
+- name: Check if volume is running
   command:
     argv:
       - gluster
       - volume
       - status
-      - "{{ gluster_vol_name }}"
+      - "{{ item }}"
   register: gluster_vol_stopped
   changed_when: "not ('is not started' in gluster_vol_stopped.stderr)"
   failed_when: false
   run_once: true
-  when: gluster_vol_name == gluster_vol_handler
+  loop: "{{ gluster_vol_handler }}"
   listen: gluster_vol_restart
-- name: Stop {{ gluster_vol_name }}
+- name: "Stop {{ gluster_vol_name }}"
   gluster.gluster.gluster_volume:
     state: stopped
     name: "{{ gluster_vol_name }}"
   run_once: true
-  when: gluster_vol_stopped.changed and gluster_vol_name == gluster_vol_handler
+  loop: "{{ gluster_vol_handler }}"
+  when: gluster_vol_stopped.changed
   listen: gluster_vol_restart
-  
+  

+ 8 - 7
roles/gluster_vol/tasks/main.yml

@@ -1,3 +1,7 @@
+- name: Reset our set_facts
+  set_fact:
+    gluster_vol_handler: []
+
 - name: "Ensure group {{ gluster_vol_group }} exists"
   include_role:
     name: add_group
@@ -48,8 +52,8 @@
   run_once: true
   register: gluster_vol_create
   notify: gluster_vol_restart
-- name: Build options for {{ gluster_vol_name }}
-  set_fact:
+- name: Set options for {{ gluster_vol_name }}
+  vars:
     gluster_vol_options:
       {
         client.ssl: "{{ gluster_vol_ssl }}",
@@ -58,15 +62,12 @@
         ssl.certificate-depth: "{{ gluster_vol_cert_depth }}",
         ssl.cipher-list: "{{ gluster_vol_ciphers }}",
       }
-  when: gluster_vol_options is not defined
-- name: Set options for {{ gluster_vol_name }}
   include_tasks: options.yml
   loop: "{{ gluster_vol_options | dict2items }}"
 
-
 - name: Set handler volume (because Ansible sucks)
   set_fact:
-    gluster_vol_handler: "{{ gluster_vol_name }}"
+    gluster_vol_handler: "{{ gluster_vol_handler + [ gluster_vol_name ] }}"
 - name: Handlers break
   meta: flush_handlers
 
@@ -80,7 +81,7 @@
   wait_for:
     timeout: 1
   when: gluster_vol_started.changed
-- name: Check for sensible status for volume {{ gluster_vol_name }}
+- name: "Check for sensible status for volume {{ gluster_vol_name }}"
   command:
     argv:
       - gluster

+ 5 - 1
roles/key_store/tasks/main.yml

@@ -1,3 +1,7 @@
+- name: Reset our set_facts
+  set_fact:
+    key_store_build: false
+
 - name: Add base_user to the group "{{ key_store_group }}"
   include_role:
     name: add_group
@@ -121,4 +125,4 @@
     mount_owner: "{{ key_store_owner }}"
     mount_group: "{{ key_store_group }}"
     mount_mode: '0750'
-    mount_fs: xfs
+    mount_fs: xfs

+ 5 - 0
roles/updates/tasks/main.yml

@@ -1,3 +1,7 @@
+- name: Clear our set_facts
+  set_fact:
+    reboot_force: false
+
 - name: Workaround arm64 repo issue
   ansible.builtin.lineinfile:
     path: /etc/apt/apt.conf.d/99phased-updates
@@ -5,6 +9,7 @@
     state: present
     insertbefore: BOF
     line: 'APT::Get::Always-Include-Phased-Updates 1;'
+
 - name: Repo updates
   apt:
     update_cache: yes