Browse Source

Replace sudo with become when accessing deployment_vars.

Andrew Butcher 9 years ago
parent
commit
a2f2c884e7
27 changed files with 37 additions and 37 deletions
  1. 1 1
      playbooks/aws/openshift-cluster/config.yml
  2. 1 1
      playbooks/aws/openshift-cluster/list.yml
  3. 2 2
      playbooks/aws/openshift-cluster/scaleup.yml
  4. 2 2
      playbooks/aws/openshift-cluster/service.yml
  5. 2 2
      playbooks/aws/openshift-cluster/tasks/launch_instances.yml
  6. 1 1
      playbooks/aws/openshift-cluster/templates/user_data.j2
  7. 1 1
      playbooks/aws/openshift-cluster/terminate.yml
  8. 1 1
      playbooks/aws/openshift-cluster/update.yml
  9. 1 1
      playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
  10. 1 1
      playbooks/gce/openshift-cluster/config.yml
  11. 1 1
      playbooks/gce/openshift-cluster/list.yml
  12. 2 2
      playbooks/gce/openshift-cluster/service.yml
  13. 1 1
      playbooks/gce/openshift-cluster/tasks/launch_instances.yml
  14. 1 1
      playbooks/gce/openshift-cluster/terminate.yml
  15. 1 1
      playbooks/gce/openshift-cluster/update.yml
  16. 1 1
      playbooks/libvirt/openshift-cluster/config.yml
  17. 1 1
      playbooks/libvirt/openshift-cluster/list.yml
  18. 2 2
      playbooks/libvirt/openshift-cluster/service.yml
  19. 1 1
      playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
  20. 1 1
      playbooks/libvirt/openshift-cluster/terminate.yml
  21. 1 1
      playbooks/libvirt/openshift-cluster/update.yml
  22. 1 1
      playbooks/openstack/openshift-cluster/config.yml
  23. 2 2
      playbooks/openstack/openshift-cluster/dns.yml
  24. 5 5
      playbooks/openstack/openshift-cluster/launch.yml
  25. 1 1
      playbooks/openstack/openshift-cluster/list.yml
  26. 1 1
      playbooks/openstack/openshift-cluster/terminate.yml
  27. 1 1
      playbooks/openstack/openshift-cluster/update.yml

+ 1 - 1
playbooks/aws/openshift-cluster/config.yml

@@ -4,7 +4,7 @@
   - ../../aws/openshift-cluster/cluster_hosts.yml
   vars:
     g_ssh_user:     "{{ deployment_vars[deployment_type].ssh_user }}"
-    g_sudo:         "{{ deployment_vars[deployment_type].sudo }}"
+    g_sudo:         "{{ deployment_vars[deployment_type].become }}"
     g_nodeonmaster: true
     openshift_cluster_id: "{{ cluster_id }}"
     openshift_debug_level: "{{ debug_level }}"

+ 1 - 1
playbooks/aws/openshift-cluster/list.yml

@@ -15,7 +15,7 @@
       name: "{{ item }}"
       groups: oo_list_hosts
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: groups[scratch_group] | default([]) | difference(['localhost'])
 
 - name: List Hosts

+ 2 - 2
playbooks/aws/openshift-cluster/scaleup.yml

@@ -12,7 +12,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_update
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ groups.nodes_to_add }}"
 
 - include: ../../common/openshift-cluster/update_repos_and_packages.yml
@@ -24,7 +24,7 @@
   vars:
     g_new_node_hosts: "{{ groups.nodes_to_add }}"
     g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+    g_sudo: "{{ deployment_vars[deployment_type].become }}"
     g_nodeonmaster: true
     openshift_cluster_id: "{{ cluster_id }}"
     openshift_debug_level: "{{ debug_level }}"

+ 2 - 2
playbooks/aws/openshift-cluster/service.yml

@@ -16,7 +16,7 @@
       name: "{{ item }}"
       groups: g_service_masters
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ master_hosts | default([]) }}"
 
   - name: Evaluate g_service_nodes
@@ -24,7 +24,7 @@
       name: "{{ item }}"
       groups: g_service_nodes
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ node_hosts | default([]) }}"
 
 - include: ../../common/openshift-node/service.yml

+ 2 - 2
playbooks/aws/openshift-cluster/tasks/launch_instances.yml

@@ -173,7 +173,7 @@
     hostname: "{{ item.0 }}"
     ansible_ssh_host: "{{ item.1.dns_name }}"
     ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+    ansible_become: "{{ deployment_vars[deployment_type].become }}"
     groups: "{{ instance_groups }}"
     ec2_private_ip_address: "{{ item.1.private_ip }}"
     ec2_ip_address: "{{ item.1.public_ip }}"
@@ -188,7 +188,7 @@
     hostname: "{{ item.0 }}"
     ansible_ssh_host: "{{ item.1.dns_name }}"
     ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+    ansible_become: "{{ deployment_vars[deployment_type].become }}"
     groups: nodes_to_add
     ec2_private_ip_address: "{{ item.1.private_ip }}"
     ec2_ip_address: "{{ item.1.public_ip }}"

+ 1 - 1
playbooks/aws/openshift-cluster/templates/user_data.j2

@@ -44,7 +44,7 @@ runcmd:
 - xfs_growfs /var
 {% endif %}
 
-{% if deployment_vars[deployment_type].sudo %}
+{% if deployment_vars[deployment_type].become %}
 - path: /etc/sudoers.d/99-{{ deployment_vars[deployment_type].ssh_user }}-cloud-init-requiretty
   permissions: 440
   content: |

+ 1 - 1
playbooks/aws/openshift-cluster/terminate.yml

@@ -11,7 +11,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_terminate
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: (groups['tag_clusterid_' ~ cluster_id] | default([])) | difference(['localhost'])
 
 - name: Unsubscribe VMs

+ 1 - 1
playbooks/aws/openshift-cluster/update.yml

@@ -13,7 +13,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_update
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ g_all_hosts | default([]) }}"
 
 - include: ../../common/openshift-cluster/update_repos_and_packages.yml

+ 1 - 1
playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml

@@ -8,7 +8,7 @@
   - "{{lookup('file', '../../../../aws/openshift-cluster/cluster_hosts.yml')}}"
   vars:
     g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+    g_sudo: "{{ deployment_vars[deployment_type].become }}"
     g_nodeonmaster: true
     openshift_cluster_id: "{{ cluster_id }}"
     openshift_debug_level: "{{ debug_level }}"

+ 1 - 1
playbooks/gce/openshift-cluster/config.yml

@@ -5,7 +5,7 @@
   - ../../gce/openshift-cluster/cluster_hosts.yml
   vars:
     g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+    g_sudo: "{{ deployment_vars[deployment_type].become }}"
     g_nodeonmaster: true
     openshift_cluster_id: "{{ cluster_id }}"
     openshift_debug_level: "{{ debug_level }}"

+ 1 - 1
playbooks/gce/openshift-cluster/list.yml

@@ -15,7 +15,7 @@
       name: "{{ item }}"
       groups: oo_list_hosts
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: groups[scratch_group] | default([], true) | difference(['localhost']) | difference(groups.status_terminated | default([], true))
 
 - name: List Hosts

+ 2 - 2
playbooks/gce/openshift-cluster/service.yml

@@ -15,14 +15,14 @@
       name: "{{ item }}"
       groups: g_service_nodes
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ node_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}"
 
   - add_host:
       name: "{{ item }}"
       groups: g_service_masters
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ master_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}"
 
 - include: ../../common/openshift-node/service.yml

+ 1 - 1
playbooks/gce/openshift-cluster/tasks/launch_instances.yml

@@ -39,7 +39,7 @@
     hostname: "{{ item.name }}"
     ansible_ssh_host: "{{ item.public_ip }}"
     ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+    ansible_become: "{{ deployment_vars[deployment_type].become }}"
     groups: "{{ item.tags | oo_prepend_strings_in_list('tag_') | join(',') }}"
     gce_public_ip: "{{ item.public_ip }}"
     gce_private_ip: "{{ item.private_ip }}"

+ 1 - 1
playbooks/gce/openshift-cluster/terminate.yml

@@ -11,7 +11,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_terminate
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: (groups['tag_clusterid-' ~ cluster_id] | default([])) | difference(['localhost'])
 
 - name: Unsubscribe VMs

+ 1 - 1
playbooks/gce/openshift-cluster/update.yml

@@ -13,7 +13,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_update
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ g_all_hosts | default([]) }}"
 
 - include: ../../common/openshift-cluster/update_repos_and_packages.yml

+ 1 - 1
playbooks/libvirt/openshift-cluster/config.yml

@@ -8,7 +8,7 @@
   - ../../libvirt/openshift-cluster/cluster_hosts.yml
   vars:
     g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+    g_sudo: "{{ deployment_vars[deployment_type].become }}"
     g_nodeonmaster: true
     openshift_cluster_id: "{{ cluster_id }}"
     openshift_debug_level: "{{ debug_level }}"

+ 1 - 1
playbooks/libvirt/openshift-cluster/list.yml

@@ -15,7 +15,7 @@
       name: "{{ item }}"
       groups: oo_list_hosts
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: groups[scratch_group] | default([]) | difference(['localhost'])
 
 - name: List Hosts

+ 2 - 2
playbooks/libvirt/openshift-cluster/service.yml

@@ -18,7 +18,7 @@
     add_host:
       name: "{{ item }}"
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
       groups: g_service_masters
     with_items: "{{ g_master_hosts | default([]) }}"
 
@@ -26,7 +26,7 @@
     add_host:
       name: "{{ item }}"
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
       groups: g_service_nodes
     with_items: "{{ g_node_hosts | default([]) }}"
 

+ 1 - 1
playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml

@@ -113,7 +113,7 @@
     hostname: '{{ item.0 }}'
     ansible_ssh_host: '{{ item.1 }}'
     ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+    ansible_become: "{{ deployment_vars[deployment_type].become }}"
     groups: "tag_environment-{{ cluster_env }}, tag_host-type-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}, tag_clusterid-{{ cluster_id }}"
     openshift_node_labels: "{{ node_label }}"
   with_together:

+ 1 - 1
playbooks/libvirt/openshift-cluster/terminate.yml

@@ -14,7 +14,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_terminate
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: groups[cluster_group] | default([])
 
 - name: Unsubscribe VMs

+ 1 - 1
playbooks/libvirt/openshift-cluster/update.yml

@@ -13,7 +13,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_update
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ g_all_hosts | default([]) }}"
 
 - include: ../../common/openshift-cluster/update_repos_and_packages.yml

+ 1 - 1
playbooks/openstack/openshift-cluster/config.yml

@@ -6,7 +6,7 @@
   vars:
     g_nodeonmaster: true
     g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-    g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+    g_sudo: "{{ deployment_vars[deployment_type].become }}"
     openshift_cluster_id: "{{ cluster_id }}"
     openshift_debug_level: "{{ debug_level }}"
     openshift_deployment_type: "{{ deployment_type }}"

+ 2 - 2
playbooks/openstack/openshift-cluster/dns.yml

@@ -12,7 +12,7 @@
       name: "{{ item }}"
       groups: oo_dns_hosts_to_update
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ groups[cluster_id ~ '-dns'] }}"
 
   - name: Evaluate oo_hosts_to_add_in_dns
@@ -20,7 +20,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_add_in_dns
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ groups['tag_clusterid_' ~ cluster_id] }}"
 
 - name: Gather facts

+ 5 - 5
playbooks/openstack/openshift-cluster/launch.yml

@@ -106,7 +106,7 @@
       hostname: '{{ item[0] }}'
       ansible_ssh_host: '{{ item[2] }}'
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
       groups: 'tag_environment_{{ cluster_env }}, tag_host-type_etcd, tag_sub-host-type_default, tag_clusterid_{{ cluster_id }}'
       openshift_node_labels:
         type: "etcd"
@@ -120,7 +120,7 @@
       hostname: '{{ item[0] }}'
       ansible_ssh_host: '{{ item[2] }}'
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
       groups: 'tag_environment_{{ cluster_env }}, tag_host-type_master, tag_sub-host-type_default, tag_clusterid_{{ cluster_id }}'
       openshift_node_labels:
         type: "master"
@@ -134,7 +134,7 @@
       hostname: '{{ item[0] }}'
       ansible_ssh_host: '{{ item[2] }}'
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
       groups: 'tag_environment_{{ cluster_env }}, tag_host-type_node, tag_sub-host-type_compute, tag_clusterid_{{ cluster_id }}'
       openshift_node_labels:
         type: "compute"
@@ -148,7 +148,7 @@
       hostname: '{{ item[0] }}'
       ansible_ssh_host: '{{ item[2] }}'
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
       groups: 'tag_environment_{{ cluster_env }}, tag_host-type_node, tag_sub-host-type_infra, tag_clusterid_{{ cluster_id }}'
       openshift_node_labels:
         type: "infra"
@@ -162,7 +162,7 @@
       hostname: '{{ parsed_outputs.dns_name }}'
       ansible_ssh_host: '{{ parsed_outputs.dns_floating_ip }}'
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
       groups: '{{ cluster_id }}-dns'
 
   - name: Wait for ssh

+ 1 - 1
playbooks/openstack/openshift-cluster/list.yml

@@ -16,7 +16,7 @@
       groups: oo_list_hosts
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
       ansible_ssh_host: "{{ hostvars[item].ansible_ssh_host | default(item) }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: groups[scratch_group] | default([]) | difference(['localhost'])
 
 - name: List Hosts

+ 1 - 1
playbooks/openstack/openshift-cluster/terminate.yml

@@ -10,7 +10,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_terminate
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: (groups['tag_environment_' ~ cluster_env]|default([])) | intersect(groups['tag_clusterid_' ~ cluster_id ]|default([]))
 
 - name: Unsubscribe VMs

+ 1 - 1
playbooks/openstack/openshift-cluster/update.yml

@@ -15,7 +15,7 @@
       name: "{{ item }}"
       groups: oo_hosts_to_update
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
-      ansible_become: "{{ deployment_vars[deployment_type].sudo }}"
+      ansible_become: "{{ deployment_vars[deployment_type].become }}"
     with_items: "{{ g_all_hosts | default([]) }}"
 
 - include: ../../common/openshift-cluster/update_repos_and_packages.yml