Hi All,
There is a way to control somehow the output from Ansible? The reason I'm
asking is that I have a lot of problem to have on the result the real
summary.
The main problem I have with modules like: (SELINUX, CHKCONFIG, SERVICES
and so on).
Let's say I want to install Apache, add it to the chkconfig list and
disable SELINUX.
---
- hosts: jenkins
tasks:
- name: disable selinux
selinux: state=disabled
- name: Install Apache
yum: name=httpd state=latest
notify:
- Add to boot
handlers:
- name: Add to boot
service: name=httpd state=started enabled=yes
My second version is:
---
- hosts: jenkins
tasks:
- name: Install Apache
yum: name=httpd state=latest
- name: Add to boot
shell: chkconfig httpd on
- name: disable selinux
selinux: state=disabled
Both scenario are working fine but the problem is that when I will execute
that task one more time I will have one more time: *changed* on the
SEXLINUX/CHKCONFIG. Which is not true because it's already changed. This is
really important to know when somethings has been changed or when it
hasn't. This playbook will give me on the output/summary changed all the
time which is not true, and when someone will disable httpd from the
chkconfig (manually) I will think that this is just an Ansible which can be
a security risk here.
Second problem I have with the installing some group of packages. Let's say
I need to install 100 packages.
This is my playbook:
---
- hosts: jenkins
remote_user: root
sudo_user: root
tasks:
- name: remove old packages
shell: rpm -e {{ item }}
with_items:
- libwvstreams
- nss_db
- bluez-gnome
- (...)
This is working fine but again. When some package is not exist, on the
screen I see "ERROR", when the package has been installed I see "CHANGED".
Now... the problem here is that on the summary I will have changed: 0,
failed=1 (when 20 packages was with ERROR and 80 packages was with
CHANGED), and again this is really confusing.
Failed=1 for me is that there was a fail which is fine. But why I don't
change CHANGED on the summary when 80 packages just have been installed? I
know that this executed by with_items but should I separate each package
per separate task? To do that I think I will need to go for another
automation tool to generate the correct list which is not something cool :(
Any help will he really appreciated! :-)
Thanks,
Pawel
--
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/c5163e04-5061-4eb1-b7bb-d975dec9743e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.