Parcourir la source

set null instead of None in defaults; run yum task as superuser

Student User il y a 2 mois
Parent
commit
4c6cd33db0
3 fichiers modifiés avec 10 ajouts et 7 suppressions
  1. 2 2
      defaults/main.yml
  2. 3 0
      meta/main.yml
  3. 5 5
      tasks/main.yml

+ 2 - 2
defaults/main.yml

@@ -5,11 +5,11 @@ test_programs: []
 
 # the name of the service that needs to be manipulated by the tasks and handlers
 # TODO: maybe make service a list
-service: None
+service: null
 
 # the firewalld service to open in the public zone
 # TODO: maybe make fwsvc a list
-fwsvc: None
+fwsvc: null
 
 # the list of packages that need to be installed on the target machine
 packages: []

+ 3 - 0
meta/main.yml

@@ -1,5 +1,8 @@
 ---
 galaxy_info:
+  role_name: deploystuff
+  namespace: myroles
+
   author: Grega Bremec <gbremec@redhat.com>
   description: this is a generic deploy-anything role
   company: Red Hat

+ 5 - 5
tasks/main.yml

@@ -1,9 +1,9 @@
 ---
 - name: ensure the software is there
-  # TODO: what does yum think about an empty list as the name parameter?
+  become: true
   yum:
     name: "{{ packages }}"
-    state: latest
+    state: present
 
 - name: process any templates and publish them
   template:
@@ -34,14 +34,14 @@
   service:
     name: "{{ service }}"
     state: started
-    enabled: yes
+    enabled: true
   when: service != None
 
 - name: ensure firewall is open for the service
   firewalld:
     service: "{{ fwsvc }}"
     state: enabled
-    immediate: yes
-    permanent: yes
+    immediate: true
+    permanent: true
   when: fwsvc != None
 ...