Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 1 | --- |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 15 | |
| 16 | - hosts: all |
| 17 | gather_facts: False |
| 18 | |
| 19 | tasks: |
| 20 | - name: Update apt-get |
| 21 | raw: sudo apt-get update -qq |
Zack Williams | 11b2e5c | 2018-05-18 09:50:54 -0700 | [diff] [blame^] | 22 | tags: |
| 23 | - skip_ansible_lint # raw command in prep for python install |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 24 | |
| 25 | - name: Install python 2.7 |
| 26 | raw: sudo apt-get install -qq python2.7 |
Zack Williams | 11b2e5c | 2018-05-18 09:50:54 -0700 | [diff] [blame^] | 27 | tags: |
| 28 | - skip_ansible_lint # raw command to install python |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 29 | |
| 30 | - name: Install prerequisites for using PPA repos |
| 31 | apt: |
| 32 | name: "{{ item }}" |
| 33 | update_cache: yes |
| 34 | cache_valid_time: 3600 |
| 35 | with_items: |
| 36 | - python-pycurl |
| 37 | - software-properties-common |
| 38 | - python-netaddr |
| 39 | |
| 40 | - name: Add Ansible PPA |
| 41 | apt_repository: |
| 42 | repo={{ item }} |
| 43 | with_items: |
| 44 | - "{{ ansible_apt_repo | default('ppa:ansible/ansible') }}" |
| 45 | register: result |
| 46 | until: result | success |
| 47 | retries: 3 |
| 48 | delay: 10 |
| 49 | |
| 50 | - name: Make sure Ansible is newest version |
| 51 | apt: |
| 52 | name: "ansible" |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 53 | update_cache: yes |
| 54 | cache_valid_time: 3600 |
| 55 | |
| 56 | - name: Enable ip forwarding |
| 57 | sysctl: |
| 58 | name: 'net.ipv4.ip_forward' |
| 59 | value: 1 |
| 60 | sysctl_set: True |
| 61 | state: present |
| 62 | reload: yes |
| 63 | |
| 64 | - name: Remove swapfile from /etc/fstab |
| 65 | mount: |
| 66 | name: swap |
| 67 | fstype: swap |
| 68 | state: absent |
| 69 | |
| 70 | - name: Disable swap |
Zack Williams | 11b2e5c | 2018-05-18 09:50:54 -0700 | [diff] [blame^] | 71 | command: "swapoff -a" |
| 72 | tags: |
| 73 | - skip_ansible_lint # there isn't a module for this, command is idempotent |
| 74 | |