Re: [ansible-project] Question about force handlers

2017-09-21 Thread Anfield
Ok nevermind. This works now. I forgot to add become: yes to the main file in the last try. The task now calls the handler, despite the failure in the 2nd task. So with the tasks/main.yml tasks/main.yml - name: Install nginx yum: name: nginx state: installed register:

Re: [ansible-project] Question about force handlers

2017-09-21 Thread Anfield
So I switched around the tasks in the task/main.yml to get this, and the notify still doesnt happen tasks/main.yml - name: Install nginx yum: name: nginx state: installed register: nginx_installed notify: - restart nginx - name: Run a command that fails shell: /bin/false

[ansible-project] Question about force handlers

2017-09-21 Thread Anfield
Testing out the force handlers parameter in a role and it is not working for me.The first tasks fails, so I though the force handlers would force the second one to get trigger anyway nginx.yml --- - hosts: appservers force_handlers: True roles: - { role: nginx, when: "ansible_os_family

Re: [ansible-project] Running simple ad hoc commands via script module not working

2017-09-08 Thread Anfield
No specific requirement. I just wanted to bundle up some ad hoc commands and run them via script module. You are correct. I just recently setup that 2nd vm and didnt have ansible installed. Fixed that. Now the command runs but doesnt actually create the file, even though the output reports

[ansible-project] Running simple ad hoc commands via script module not working

2017-09-08 Thread Anfield
I have a playbook and a script file which contains a couple of simple ad hoc commands, but it is not working. I have 2 VMs on my desktop which are linked up via custom host-only 10.10.x.x network. Connection is working, other playbooks work fine etc. Playbook - --- - hosts: 10.10.0.4

[ansible-project] Blockinfile - how to delete text

2017-08-31 Thread Anfield
I have this text file and I was trying to delete some text that I had just added. Not sure how I would go about deleting 1) The entire text tree and the wrappers #BEGIN ANSIBLE MANAGED BLOCK 2) Just deleting the text tree Can anyone explain? Thanks The delete functionality is not functioning

Re: [ansible-project] Filtering on a Template variable

2017-08-25 Thread Anfield
That works thanks. I suppose what confused me a little was when trying to do this via command line I had to use grep.. [ansible@localhost exercises]$ ansible local -m setup -a 'filter=ansible_default_ipv4*' | grep address > -- You received this message because you are subscribed to the

[ansible-project] Filtering on a Template variable

2017-08-24 Thread Anfield
How can I filter a variable in a template so that I can extract a fact Trying to get the default ipv4 address from a template template.j2 ipv4 address ((ansible_default_ipv4 | grep address}} A similar format will work via command line but not via a template. Whats the correct formatting

[ansible-project] Ansible facts from command line - drill down

2017-08-23 Thread Anfield
Running this from command link - ansible all -m setup -a 'filter=ansible_default_ipv4*' The output is 127.0.0.1 | SUCCESS => { "ansible_facts": { "ansible_default_ipv4": { "address": "192.168.150.129", "alias": "eno1636", "broadcast":

[ansible-project] Re: How to call roles & specify tags for those roles

2017-08-22 Thread Anfield
Good question Mike, no requirement, just learning this incase it comes up in the cert. exam. Based on that link from the docs I still dont know why you would call a role with tags >> >> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group.

[ansible-project] Re: How to call roles & specify tags for those roles

2017-08-18 Thread Anfield
If I remove the tag from the role and leave it on the task, then it will run both tasks? Both tasks are tagged -- 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

[ansible-project] Re: How to call roles & specify tags for those roles

2017-08-17 Thread Anfield
Ok..Not sure I follow. So what would be the point then in calling a role with tags at all, if you cannot define which tag to use? >> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails

[ansible-project] How to call roles & specify tags for those roles

2017-08-16 Thread Anfield
Trying to run an example from the ansible docs, and it seems to always run both the tagged portions of the playbook... Am I missing how calling a role with tags is supposed to be used? Ansible docs - http://docs.ansible.com/ansible/latest/playbooks_tags.html roles: - { role: webserver,

Re: [ansible-project] Loop using with_items twice

2017-07-21 Thread Anfield
Yes thats exactly what I wanted to do but I thought I had to use with_items at the bottom to provide the list that it would loop through. Thanks > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

[ansible-project] Loop using with_items twice

2017-07-20 Thread Anfield
What is the correct way to use with_Items to loop over two files? The playbook is failing at the 2nd task Getting an error - TASK [Create users from vars users] fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid

Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-14 Thread Anfield
Thanks. So its clear why this didnt work. Can I ask you how I can tell the playbook to switch to root to execute the commands on the localhost with escalated privileges? > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe

Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-12 Thread Anfield
How would I get around this issue on the localhost? I tried adding become_user: root and that didnt work either > -- 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

Re: [ansible-project] Playbook Failys atc copying ssh keys

2017-07-09 Thread Anfield
Yes. Definitely. I even remove the variables in that part, and just put in /home/dave/.ssh/id_rsa.pub Generated the same errors. > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails

Re: [ansible-project] ansible 2 lists in playbook vars file

2017-07-08 Thread Anfield
Hi, Thanks for the reponse. This works but I dont quite understand it... So copylist is now basically a list with two listed values - src - src How does it pick up dest when its not really designated as a list item with a dash (-)? I wouldve expected -dest to be listed aswell twice --

[ansible-project] ansible 2 lists in playbook vars file

2017-07-08 Thread Anfield
Trying to get a playbook working with yml file containing 2 lists and passing that into the main file to loop over. Can someone help with letting me know what I'm doing wrong? Thanks copylist.yml --- copylist: src: - /home/ansible/tom/tom.txt - /home/ansible/fred/fred.txt

[ansible-project] Playbook Failys atc copying ssh keys

2017-07-08 Thread Anfield
I have the below playbook. Created ssh keys for dave on the localhost (ansible master) and trying to create some users, groups and copy over ssh keys for some users all in the playbook. All works well until the copying over ssh keys part. Ive confirmed the directory and public key exists for

Re: [ansible-project] get_url runs but doesnt download the file

2017-07-07 Thread Anfield
Hi Joe. Yes the file does exist on 10.10.0.5...I thought get-url would download from the target (10.10.0.5) to the local ansible server (My master I am runing the playbook from) Unless I am misunderstanding how this should work.? >> -- You received this message because you are subscribed to

Re: [ansible-project] Re: Creating users & groups with vars - not working

2017-07-07 Thread Anfield
Thanks. It works but only if I swap with_items: "{{groups}}" for with_items: "{{grouplist}}" and call my vars grouplist also. Something it didnt like about calling those 2 groups > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

[ansible-project] Creating users & groups with vars - not working

2017-07-06 Thread Anfield
Trying to create users and groups with vars inline...this is not working..what am I missing here? --- # Users and Groups - hosts: localhost become: yes vars: groups: - devops - dbadbmins - serveradmins users: - frank - joe - dave

[ansible-project] Create users and groups using with_files

2017-07-06 Thread Anfield
Trying to create groups and then users using with files and its not working..How should the lists be represented in the groups vars file and the users vars file? It doesnt like it just as text below..how am I supposed to list the values out? How do people normally create a few users and groups

Re: [ansible-project] Custom Fact - Drill down into each variable

2017-07-04 Thread Anfield
Thanks. It works now Changed the playbook line to this and it works fine -> debug: msg="Custom facts are {{ansible_local.preference.general.material}}" Output - PLAY [localhost] *** TASK [Gathering Facts]

[ansible-project] Custom Fact - Drill down into each variable

2017-07-04 Thread Anfield
Created a custom fact which only seems to work when not executable - etc/ansible/facts.d/preference.fact [new facts] material = concrete structure = square When the preference.fact is set to executable I get the following error - TASK [Gathering Facts]

[ansible-project] Custom fat drill down, and error message

2017-07-04 Thread Anfield
I have a custom fact as follows - /etc/ansible/facts.d/preference.fact [new facts] material = concrete structure = square When this is not executable, it works, when it is executable it throws an error (shown below) TASK [Gathering Facts]

Re: [ansible-project] get_url runs but doesnt download the file

2017-07-03 Thread Anfield
Their both vms on my laptop so none is really "remote" - but in this case the local is the one running the playbook.. > > -- 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,

Re: [ansible-project] get_url runs but doesnt download the file

2017-07-03 Thread Anfield
Hi. What I am expecting is just for the file to be downloaded from the remote host to the local (again both vms') The output tells me that it has run (and flagged as changed) - but when I look into the local target dir - the file is never there..am I missing something? -- You received this

[ansible-project] get_url runs but doesnt download the file

2017-07-03 Thread Anfield
I have 2 vms both running centos and ansible, running a get_url test and the playbook runs fine and says changed = 1 but the file never gets downloaded to the target I have apache running on the server that hosts the file (root owns the remote dir - /var/www/html Any ideas? Thanks. ansible v

Re: [ansible-project] Ansible variable with find

2017-07-03 Thread Anfield
Great explanation. Thanks -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to

Re: [ansible-project] Ansible variable with find

2017-06-30 Thread Anfield
Thanks! But how does it differentiate between just the text user, and the actual variable user? Or does it just know because user is defined as a variable at the top in the vars section? I tried that out and it works well. > -- You received this message because you are subscribed to the

[ansible-project] Ansible variable with find

2017-06-27 Thread Anfield
Running the playbook below and wondering whats the correct syntax so I can use a variable within the find statement below This line is in question - when: p.stdout.find"{{('user')}}" != -1 This would be correct without a variable when: p.stdout.find('daniel') != -1 How do I do this

Re: [ansible-project] Re: Ansible Copy module error - "Exec format error"

2017-06-22 Thread Anfield
Ok. Thanks. Once I update the stuff.fact file then the playbook runs fine. > -- 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

Re: [ansible-project] Re: Ansible Copy module error - "Exec format error"

2017-06-22 Thread Anfield
The src directory is executable > > >> -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group,

Re: [ansible-project] Re: Ansible Copy module error - "Exec format error"

2017-06-22 Thread Anfield
I dont follow. Its not a file though, its a directory. Both are directories.. > -- 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

[ansible-project] Re: Ansible Copy module error - "Exec format error"

2017-06-22 Thread Anfield
Resolved this when I set gather_facts: no. Anyone know why that would be? ansible 2.3.0.0 > -- 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

Re: [ansible-project] lineinfile anywhere match

2017-06-02 Thread Anfield
Ah I didnt see the bit at the bottom. Thanks > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to

Re: [ansible-project] lineinfile anywhere match

2017-06-02 Thread Anfield
Found the answer, from the below list, purple replaced brown with the > playbook further below crimson blahstuffcans buns buns grey purple orange grey grey %jabba% jabba1 Below replaced brown with purple for example --- - hosts: local tasks: - name: Line In File lineinfile:

Re: [ansible-project] lineinfile anywhere match

2017-06-02 Thread Anfield
Ive read both. Its still not clear to me how to do an anywhere match on a string > -- 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

[ansible-project] lineinfile anywhere match

2017-06-02 Thread Anfield
How do I do an anywhere match for a string and replace with some text? The below playbook doesnt work. But just looking for example to search for part of green - reen and replace this with jabba. How do I do that? Thanks List red blahstuffcans buns buns grey green brown red grey grey

Re: [ansible-project] [WARNING]: While constructing a mapping from /etc/ansible/playbooks/touch.yml, line 2, column 3, found a duplicate dict key (tasks). Using last defined value only.

2017-05-19 Thread Anfield
Ok, nevermind. Only one instance of the tasks:, but multiple tasks underneath. Thanks! > -- 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

Re: [ansible-project] [WARNING]: While constructing a mapping from /etc/ansible/playbooks/touch.yml, line 2, column 3, found a duplicate dict key (tasks). Using last defined value only.

2017-05-19 Thread Anfield
Only one task for each playbook? Didnt know 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 ansible-project+unsubscr...@googlegroups.com. To post

[ansible-project] Re: [WARNING]: While constructing a mapping from /etc/ansible/playbooks/touch.yml, line 2, column 3, found a duplicate dict key (tasks). Using last defined value only.

2017-05-19 Thread Anfield
When I comment out the directory piece and run it again, ansible will create the file > -- 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

[ansible-project] [WARNING]: While constructing a mapping from /etc/ansible/playbooks/touch.yml, line 2, column 3, found a duplicate dict key (tasks). Using last defined value only.

2017-05-19 Thread Anfield
I have the following playbook and I got the above error. This created the directory but not the file. Any ideas? --- - hosts: local tasks: - name: create a file if it doesnt exist file: path: /home/ansible/touchfile.txt state: touch mode: 0755 tasks: - name:

[ansible-project] Ansible Errors when running Playbook

2017-04-17 Thread Anfield
Getting the following errors - can anyone help? Traceback (most recent call last): File "/usr/bin/ansible-playbook", line 41, in from multiprocessing import Lock File "/usr/lib64/python2.7/multiprocessing/__init__.py", line 65, in from multiprocessing.util import SUBDEBUG,

Re: [ansible-project] SSH not working to client machine (ssh from command line works) - Ansible 2.1.0

2016-08-26 Thread Anfield
Used a brand new ubuntu 16 desktop vm and the ping works..issue resolved -- 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

Re: [ansible-project] SSH not working to client machine (ssh from command line works) - Ansible 2.1.0

2016-08-25 Thread Anfield
yes I am logged into the controller as admin and also yes I as admin I can run ssh 10.10.128.2 (Client IP) and connect just using command line.. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

Re: [ansible-project] SSH not working to client machine (ssh from command line works) - Ansible 2.1.0

2016-08-25 Thread Anfield
No - all I am doing here is a ping to validate that the controller and target can communicate. This should work before I setup playbooks. Since I read somewhere that it makes sense to setup an ansible user on each machine for use with ansible I had the admin user on each server previously

[ansible-project] Re: SSH not working to client machine (ssh from command line works) - Ansible 2.1.0

2016-08-25 Thread Anfield
Anyone? -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to

[ansible-project] SSH not working to client machine (ssh from command line works) - Ansible 2.1.0

2016-08-24 Thread Anfield
When I run ansible all -m ping - from the controller to the client (ubuntu) I get the following - Loaded callback minimal of type stdout, v2.0 <10.10.128.0> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.10.128.0 <10.10.128.2> ESTABLISH SSH CONNECTION FOR USER: None

[ansible-project] Re: win_package - missing product id error

2016-08-23 Thread Anfield
Any ideas anyone? -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to

[ansible-project] Re: win_package - missing product id error

2016-08-23 Thread Anfield
Also took the product id from the registry of my machine and tried that in the playbook also, same result > > -- 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

[ansible-project] Re: win_package - missing product id error

2016-08-23 Thread Anfield
Changed my playbook to the following but it seems like it stalls and doesnt provide an final error #Install Notepad 6.9.2 from specified repository - hosts: all gather_facts: false tasks: - name: Install Notepad 6.9.2 Package win_package: path:

[ansible-project] Re: win_package - missing product id error

2016-08-23 Thread Anfield
so is there no way I can use a dummy id? Id have to install on another machine first and then find the product_id? -- 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

[ansible-project] Re: win_package - missing product id error

2016-08-19 Thread Anfield
Nevermind - I just added product_id="notepad" to get past this error > -- 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

[ansible-project] win_package - missing product id error

2016-08-19 Thread Anfield
Trying to install notepad onto a windows 2012 server and getting an error "Missing required arguement: product_id" - Do I have to go lookup a product id for every .exe I want to install? Where do I get this? -notepad.yml #Install Notepad 6.9.2 from executable in shared drive - hosts: all

[ansible-project] Re: Windows Playbook Fails Using win_user

2016-08-11 Thread Anfield
That was perfect. Thanks! -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to

[ansible-project] Re: Connection issues to Windows Server - Host not Reachable

2016-08-10 Thread Anfield
I thought the ping all command would literally ping all hosts. Anyway I tried -> ansible 10.10.128.0 -m win_ping, and I think this looks good 10.10.128.0 | *SUCCESS* => { "changed": false, "ping": "pong" } -- You received this message because you are subscribed to the Google Groups

[ansible-project] Re: Connection issues to Windows Server - Host not Reachable

2016-08-10 Thread Anfield
> > Thanks for the update. I created the group_vars and added the windows.yml >> in there/ Tried an ansible all -m ping - and get the following error >> > On the linux control machine when I look at the python version it is 2.7.5, do I need to update that? Error msg - Loaded callback

[ansible-project] Re: Connection issues to Windows Server - Host not Reachable

2016-08-10 Thread Anfield
> > Using version 2.1.0.0 >>> >> Have not created group_vars/windows.yml. I just created windows.yml under the ansible directory. Do I need to create the group_vars directory first? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

[ansible-project] Re: Connection issues to Windows Server - Host not Reachable

2016-08-10 Thread Anfield
Hi - any further thoughts? > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send

[ansible-project] Re: Connection issues to Windows Server - Host not Reachable

2016-08-09 Thread Anfield
I agree!. I am new to Ansible.. I just have two virtual machines on my desktop and all that I have configured is listed below - -Configured windows.yml - with the following - ansible_ssh_user: User ansible_ssh_pass: Pass ansible_ssh_port: 5986 ansible_connection: winrm , added the windows host

[ansible-project] Re: Connection issues to Windows Server - Host not Reachable

2016-08-09 Thread Anfield
Thanks. I think I have those configured though ansible_ssh_user: User ansible_ssh_pass: Pass ansible_ssh_port: 5986 ansible_connection: winrm -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

[ansible-project] Connection issues to Windows Server - Host not Reachable

2016-08-09 Thread Anfield
Trying to connect from Ansible server to windows host and getting connection errors [root@localhost ansible]# ansible -i hosts -m ping all 10.10.128.0 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true -Configured windows.yml,

[ansible-project] Connecting to Windows Host Failing - (Fails Ansible Ping)

2016-08-09 Thread Anfield
Connecting from ansible to windows hosts I am getting the following error when I run this command ansible -i hosts -m ping all ERROR "msg": "Failed to connect to the host via ssh.", "unreachable": true The hosts can ping each other and the windows machine has been added in the ansible