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: nginx_installe
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
Ou
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
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 chan
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
become
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 a
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 Googl
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 require
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": "192.168.
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.
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 e
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 f
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, port
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 rece
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 v
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 fro
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 ema
Good point. The fact the playbook has become: yes in it - does that not
apply to the commands that run on the localhost and the target? This
playbook is just running against the target 10.10.0.5
Maybe I'm misunderstanding the use of the elevated permissions..
>
>
--
You received this message
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 f
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
--
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
de
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 d
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
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
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
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
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]
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]
**
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]
*
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, send
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
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
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 a
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 Goog
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 with
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 ansible-project+unsubscr...@goo
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,
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+unsubscr...
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 ansible-project
I get the error below when trying to copy a directory (from local to local)
Anyone know why? (It doesn't work either with trailing slashes in src and
destination, also destination does exist)
*
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd":
"/etc/ansible/facts.d/stuff.fact", "failed":
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 this
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:
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+unsubscr
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
Playb
---
- hosts: localhost
become: yes
tasks:
- name: Check if a file exists
stat:
path: /home/ansible/test.txt
register: file
- debug: var="file exists"
when: file.stat.exists == true
The above doesnt work, can anyone tell me why?
The output is
PLAY [localhost]
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 ansible-project+un
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 t
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+uns
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: cr
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, SUBWARNIN
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 ansible-project+unsubscr...@googlegro
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 receivin
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
setup
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@goo
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
<
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-p
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
t
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:
\\IT1352\Users\user\Documents
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 emai
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+unsubscr...@googlegro
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
gat
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
Trying to run a playbook to add a user on a windows server and getting
errors, see below
[root@localhost group_vars]# ansible-playbook createuser.yml
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/etc/ansible/group_vars/createuser.yml':
line 2, column 1, but may
be
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
"
>
> 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 mini
>
> 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 unsubsc
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 email
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
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 receiving
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, a
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 ho
71 matches
Mail list logo