LoginSignup
21
20

More than 5 years have passed since last update.

ansibleでansibleをいれるplaybookを作る

Last updated at Posted at 2013-08-17

https://github.com/masahide/ansible-ansible
ansibleでansibleを入れるためのplaybookを作った。
踏み台サーバー等に入れるときに使うつもり。

roles/ansible/tasks/main.yml
- name: install python (CentOS 6)
  yum: name={{item}} enablerepo=epel state=installed
  with_items:
    - PyYAML
    - python-paramiko
    - python-jinja2
  when: ansible_os_family == 'RedHat' and ansible_distribution_version.split('.')[0]|int == 6
  tags: python

- name: install python26 (CentOS 5)
  yum: name={{item}} enablerepo=epel state=installed
  with_items:
    - python26
    - python26-PyYAML
    - python26-paramiko
    - python26-jinja2
  when: ansible_os_family == 'RedHat' and ansible_distribution_version.split('.')[0]|int == 5
  tags: python

- name: git clone ansible 
  git: repo=git://github.com/ansible/ansible.git
       dest={{ ansible_cache_dir }}/ansible
       version=v1.3.1
  register: git_result

- name: install ansible (CentOS 6)
  shell: |
    make install
    chdir={{ ansible_cache_dir }}/ansible creates=/usr/bin/ansible
  when: git_result.changed and ansible_os_family == 'RedHat' and ansible_distribution_version.split('.')[0]|int == 6
  tags: ansible

- name: install ansible (CentOS 5)
  shell: |
    sed -i 's/^PYTHON=.*/PYTHON=python26/' Makefile  &&
    make install
    chdir={{ ansible_cache_dir }}/ansible creates=/usr/bin/ansible
  when: git_result.changed and ansible_os_family == 'RedHat' and ansible_distribution_version.split('.')[0]|int == 5
  tags: ansible
21
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
20