Commit 031f7ab9 by Arbab Nazar Committed by GitHub

Merge pull request #3134 from edx/arbab/aws-rewrite

use fully expanded YAML dictionaries for ansible tasks
parents 658f6566 0b2af04c
......@@ -24,71 +24,80 @@
#
# Start dealing with Jumbo frames issue in mixed MTU deployements in AWS
#
- name: gather ec2 facts for use in other roles
- name: Gather ec2 facts for use in other roles
action: ec2_facts
tags:
- deploy
- shell: >
/sbin/ifconfig eth0 mtu 1500 up
- name: Set the MTU to 1500 temporarily
shell: /sbin/ifconfig eth0 mtu 1500 up
when: ansible_distribution in common_debian_variants
- name: check for eth0.cfg
stat: path=/etc/network/interfaces.d/eth0.cfg
- name: Check for eth0.cfg
stat:
path: /etc/network/interfaces.d/eth0.cfg
register: eth0_cfg
when: ansible_distribution in common_debian_variants
- lineinfile: >
dest=/etc/network/interfaces.d/eth0.cfg
regexp="^post-up /sbin/ifconfig eth0 mtu 1500"
line="post-up /sbin/ifconfig eth0 mtu 1500"
insertafter="^iface"
- name: Set the MTU to 1500 inside eth0.cfg file
lineinfile:
dest: /etc/network/interfaces.d/eth0.cfg
regexp: "^post-up /sbin/ifconfig eth0 mtu 1500"
line: "post-up /sbin/ifconfig eth0 mtu 1500"
insertafter: "^iface"
when: ansible_distribution in common_debian_variants and eth0_cfg.stat.exists
#
# End dealing with Jumbo frames issue in mixed MTU deployements in AWS
#
- name: create all service directories
file: >
path="{{ item.value.path }}"
state="directory"
owner="{{ item.value.owner }}"
group="{{ item.value.group }}"
mode="{{ item.value.mode }}"
with_dict: aws_dirs
- name: install system packages
apt: >
pkg={{','.join(aws_debian_pkgs)}}
state=present
update_cache=yes
- name: Create all service directories
file:
path: "{{ item.value.path }}"
state: directory
owner: "{{ item.value.owner }}"
group: "{{ item.value.group }}"
mode: "{{ item.value.mode }}"
with_dict: "{{ aws_dirs }}"
- name: Install system packages
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items: "{{ aws_debian_pkgs }}"
when: ansible_distribution in common_debian_variants
- name: install aws python packages
pip: >
name="{{ item }}" state=present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
with_items: aws_pip_pkgs
- name: Install aws python packages
pip:
name: "{{ item }}"
state: present
extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }}"
with_items: "{{ aws_pip_pkgs }}"
- name: create s3 log sync script
template: >
dest={{ aws_s3_sync_script }}
src=send-logs-to-s3.j2 mode=0755 owner=root group=root
- name: Create s3 log sync script
template:
dest: "{{ aws_s3_sync_script }}"
src: send-logs-to-s3.j2
mode: 0755
owner: root
group: root
when: AWS_S3_LOGS
- name: create symlink for s3 log sync script
file: >
state=link
src={{ aws_s3_sync_script }}
dest={{ COMMON_BIN_DIR }}/{{ aws_s3_sync_script|basename }}
- name: Create symlink for s3 log sync script
file:
state: link
src: "{{ aws_s3_sync_script }}"
dest: "{{ COMMON_BIN_DIR }}/{{ aws_s3_sync_script|basename }}"
when: AWS_S3_LOGS
- name: force logrotate on supervisor stop
template: >
src=etc/init/sync-on-stop.conf.j2
dest=/etc/init/sync-on-stop.conf
owner=root group=root mode=0644
- name: Force logrotate on supervisor stop
template:
src: etc/init/sync-on-stop.conf.j2
dest: /etc/init/sync-on-stop.conf
owner: root
group: root
mode: 0644
when: AWS_S3_LOGS
# update the ssh motd on Ubuntu
......@@ -96,25 +105,24 @@
# and add a custom motd. These do not require an
# ssh restart
# Only needed for EC2 instances.
- name: update the ssh motd on Ubuntu
file: >
mode=0644
path={{ item }}
when: vagrant_home_dir.stat.exists == false
- name: Update the ssh motd on Ubuntu
file:
path: "{{ item }}"
mode: 0644
when: (vagrant_home_dir.stat.exists == false) and (ansible_distribution in common_debian_variants)
with_items:
- "/etc/update-motd.d/10-help-text"
- "/usr/share/landscape/landscape-sysinfo.wrapper"
- "/etc/update-motd.d/51-cloudguest"
- "/etc/update-motd.d/91-release-upgrade"
when: ansible_distribution in common_debian_variants
- "/etc/update-motd.d/10-help-text"
- "/usr/share/landscape/landscape-sysinfo.wrapper"
- "/etc/update-motd.d/51-cloudguest"
- "/etc/update-motd.d/91-release-upgrade"
- name: update /etc/dhcp/dhclient.conf
- name: Update /etc/dhcp/dhclient.conf
template:
src: etc/dhcp/dhclient.conf.j2
dest: /etc/dhcp/dhclient.conf
when: COMMON_CUSTOM_DHCLIENT_CONFIG
- name: copy the MOTD template in place
- name: Copy the MOTD template in place
template:
dest: "{{ item.dest }}"
src: "{{ item.src }}"
......@@ -140,14 +148,18 @@
line: "PasswordAuthentication {{ COMMON_SSH_PASSWORD_AUTH }}"
register: sshd_config
- name: restart ssh
service: name=ssh state=restarted
- name: Restart ssh
service:
name: ssh
state: restarted
become: True
when: sshd_config.changed
when: ansible_distribution in common_debian_variants
- name: restart ssh
service: name=sshd state=restarted
- name: Restart ssh
service:
name: sshd
state: restarted
become: True
when: sshd_config.changed
when: ansible_distribution in common_redhat_variants
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment