Skip to main content

Ansible: How installing a group of packages?

Installing a set of packages with Ansible

The context

I need to install a group of packages on multiple Linux servers. Ansible is the right tool for that.


The host file: hosts

[test_machines]
   test1.my_domain.com
   test2.my_domain.com
[dev]
   dev1.my_domain.com
   dev2.my_domain.com
[uat]
   uat1.my_domain.com
   uat2.my_domain.com
[prod]
   prd1.my_domain.com
   prd2.my_domain.com


The playbook : add_packages.yml

- hosts: all
  vars_files:
    - data/all_my_packages.yml

  tasks:
  - name: Ensure a set of packages is installed.
    yum:
      name={{ item.name }}
      state={{ item.state }}
    with_items: '{{ packages }}'



The datafile: data/all_my_packages.yml

packages:
 - { name: 'glibc.i686', state: 'present' }
 - { name: 'glibc.x86_64', state: 'present' }
 - { name: 'glibc-common', state: 'present' }
 - { name: 'glibc-devel', state: 'present' }
 - { name: 'glibc-headers', state: 'present' }
 - { name: 'libstdc++.i686', state: 'present' }
 - { name: 'libstdc++.x86_64', state: 'present' }
 - { name: 'libstdc++-devel.x86_64', state: 'present' }
 - { name: 'compat-libstdc++-33.i686', state: 'present' }
 - { name: 'compat-libstdc++-33.x86_64', state: 'present' }
 - { name: 'compat-libstdc++-296-2.96-144.el6.i686', state: 'present' }
 - { name: 'pam.i686', state: 'present' }
 - { name: 'pam.x86_64', state: 'present' }
 - { name: 'gtk2.i686', state: 'present' }
 - { name: 'gtk2.x86_64', state: 'present' }
 - { name: 'xorg-x11-xauth.x86_64', state: 'present' }
 - { name: 'dos2unix', state: 'present' }



The command

Checking on subset of servers:
# ansible-playbook add_packages.yml --check -i hosts --limit test_machines


Running:
# ansible-playbook add_packages.yml -i hosts

Comments

Popular posts from this blog

Drive replacement for Fostex DMT8-vl

The IDE hard drive on my Fostex DMT8-vl multitrack recorder shows signs of its imminent death; when getting hot, I could not record anymore. Must be said this drive comes from an old Sun Station, and has been replaced because I/O failures were detected by Solaris. It worked at least 5 years in my recorder: not so bad. However, time is now to replace it. The DMT8-vl is not able to handle drives bigger than 8.4 GB. Well, it is able to (the current drive is 15 GB), but only 8.4 GB will be usable. My tought was to use a 8 GB CompactFlash; having no moving parts means no noise, which is quite temptating for a music recording device. I purchased a CompactFlash-IDE adapter on the internet (8$) and I had to build a male-male IDE cable adapter (4$). Unfortunately, this doesn't work. The drive is correctly discovered by the operating system, which proposes to format it ("format IDE?"). After answering "yes", the formating runs pretty fast (faster than on a real drive), ...

Samba: Clients get "system error 1223" (or 123) after a server reboot

Facts: a Linux+Samba server shares anonymously a folder. After a reboot, Win clients could not attach the share drive anymore. C:\>net use \\mylinux\folder Enter the user name for 'mylinux': System error 1223 has occurred. The operation was canceled by the user. C:\>net view \\mylinux\ System error 123 has occurred. The filename, directory name, or volume label syntax is incorrect. The process are present, and tcpdump doesn't provide much information. What's going on? After hours of headscratching, the light came: the firewall was on and no rules for the Samba protocol! Grrr!

Issue with Soundpool MO4

I have a Atari STe with a Soundpool MO4 MIDI extension. It used to work very well, but unfortunatelly doesn't anymore: Cubase still detects it, and I can output MIDI to it but nothing is coming out from any MIDI Out. It took me a while to tackle it (lack of time, lack of tool, other items to play with), but I gave a glance last week-end. The parallel port on the Atari uses only the following signals: Pin 1 : Strobe (Atari -> MO4) Pin 2 : Data 0 (Atari -> MO4) Pin 3 : Data 1 (Atari -> MO4) Pin 4 : Data 2 (Atari -> MO4) Pin 5 : Data 3 (Atari -> MO4) Pin 6 : Data 4 (Atari -> MO4) Pin 7 : Data 5 (Atari -> MO4) Pin 8 : Data 6 (Atari -> MO4) Pin 9 : Data 7 (Atari -> MO4) Pin 11: Busy (MO4 -> Atari) The MO4 also decodes few other pins, but since the Atari doesn't, my guess is the MO4 was also targeted for PC. Inside the box, the MO4 is architectured around a CPLD (IspLSI1016 from Lattice) which contains the logi...