Hi Mike,

When I say "moved it up one level", I meant I took my hosts file out of the 
roles directory and moved it up one level out of there. 

Now, back to your suggestions. For your first point, I am not sure I 
follow. For example, you said to run my play (I understand this as task) 
with 'hosts: testservers'. How would I do that? I thought your hosts: were 
defined in the main.yml outside of tasks folder. For example, here is what 
I have:

In app_install_main.yml:

---

- name: install app and join systems to domain
 hosts: testservers
 become: yes

  roles:
  - app_install

  vars_prompt:
  - name: "ansible_sudo_pass"
    prompt: "Sudo password"
    private: yes

It is here where I am calling my hosts: testservers. Then in my 
task/main.yml, I have:

---
# tasks file for app_install

- name: Install required nfs packages
yum: name={{ item }} state=present
with_items:
- nfs-utils
- nfs-utils-lib

- name: Create a temporary mount point for the installation files
file: path=/tmp/app_install state=directory owner=root group=root mode=0775

- name: Mount the nfs share from nfsshare.domain.tld
shell: mount -F -t nfs -o vers=3 -v nfsshare.domain.tld:/share/location /tmp
/app_install

- name: Install app on test systems
command: /tmp/app_install/apptool_install arg1
when: "'testserver'in group_names"

- name: Join test systems to test ou
shell: /path/to/domainjoin-cli join --notimesync --disable hostname
         --ou OU=test,OU=UNIX,DC=server,DC=domain,DC=tld server.domain.tld 
join_account
when: "'testserver' in group_names"

As you can see, I am adding your suggestion here too. I am not sure I grasp 
what you mean by "Use multiple plays. Have one play run with 'hosts: 
testservers' and another play run on some other set of hosts. Group the 
tasks in the appropriate plays". I am still trying to wrap my head around 
that.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/88286b9c-a89f-4454-a9ef-c10d7d5d4367%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to