Hello,
I have been searching a couple of days off and on.
I am using ansible 1.7 and in the process of creating a playbook to check
the kernel version and if it is lower than X check if python-simplejson is
installed. If it is not then install the package.
Below is a sample of my simple playbook.
---
- hosts: test
gather_facts: false
tasks:
- name: Querying Kernel Version
raw: uname -r
register: kernel_version
ignore_errors: True
#- name: Check/Install if python-simplejson is installed (Old Kernels)
- raw: yum -qy install python-simplejson
#raw: rpm -q python-simplejson
when: kernel_version.stdout.find("2.6.18") != -1
register: rpm_check
ignore_errors: True
Sample of my host file.
[test]
ClientA ansible_ssh_port=2209 ansible_ssh_host=192.168.1.12
ansible_ssh_user=userA
ClientB ansible_ssh_port=20243 ansible_ssh_host=192.168.1.11
ansible_ssh_user=userB
When i run the playbook with the following command.
ansible-playbook common/os_check.yml --su-user=root --ask-su-pass -vvvv
or
ansible-playbook common/os_check.yml -R --step -vvvv
I get the following ERROR. I noticed that it never passes the root user.....
PLAY [test]
*******************************************************************
TASK: [Querying Kernel Version]
***********************************************
<192.168.1.12> ESTABLISH CONNECTION FOR USER: userA on PORT 2209 TO 192.168.
1.12
<192.168.1.11> ESTABLISH CONNECTION FOR USER: userB on PORT 20243 TO 192.168
.1.11
<192.168.1.11> EXEC uname -r
ok: [ClientB] => {"rc": 0, "stderr": "", "stdout": "2.6.32-279.el6.x86_64\n"
}
fatal: [192.168.1.12] => {'msg': 'FAILED: Authentication failed.', 'failed':
True}
TASK: [raw yum -qy install python-simplejson]
*********************************
skipping: [ClientB]
PLAY RECAP
********************************************************************
to retry, use: --limit @/home/userA/os_check.retry
ClientB : ok=1 changed=0 unreachable=0 failed=0
ClientA : ok=0 changed=0 unreachable=1 failed=0
I would think it would run as the user i told it to run as. It seems that
the hosts file overrides whatever parameter i give it....I might be
thinking of this wrong...
thanks for your help!
--
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/c21aa37d-6929-4bd8-a6bf-7467c5695390%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.