Zack Williams | 41513bf | 2018-07-07 20:08:35 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 14 | - name: JQ is present |
| 15 | apt: |
| 16 | name: jq |
| 17 | force: yes |
| 18 | tags: [common] |
| 19 | |
| 20 | - name: Host is present |
| 21 | lineinfile: |
| 22 | dest: /etc/hosts |
| 23 | regexp: "^{{ item.host_ip }}" |
| 24 | line: "{{ item.host_ip }} {{ item.host_name }}" |
Rouzbahan Rashidi-Tabrizi | 0f7eb2b | 2016-11-08 12:30:12 -0800 | [diff] [blame] | 25 | with_items: "{{ hosts }}" |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 26 | tags: [common] |
| 27 | |
| 28 | - name: Latest apt packages |
| 29 | apt: |
| 30 | name: "{{ item }}" |
Rouzbahan Rashidi-Tabrizi | 0f7eb2b | 2016-11-08 12:30:12 -0800 | [diff] [blame] | 31 | with_items: "{{ use_latest_for }}" |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 32 | tags: [common] |
| 33 | |
| 34 | - name: Services are not running |
| 35 | service: |
| 36 | name: "{{ item }}" |
| 37 | state: stopped |
| 38 | ignore_errors: yes |
Rouzbahan Rashidi-Tabrizi | 0f7eb2b | 2016-11-08 12:30:12 -0800 | [diff] [blame] | 39 | with_items: "{{ obsolete_services }}" |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 40 | tags: [common] |
| 41 | |
David K. Bainbridge | a2a46ae | 2017-10-24 14:05:33 -0700 | [diff] [blame] | 42 | - name: Ensure SSH directory exists |
| 43 | file: |
| 44 | path: "{{ ansible_env['HOME'] }}/.ssh" |
| 45 | state: directory |
| 46 | owner: "{{ ansible_env['SUDO_USER'] }}" |
| 47 | group: "{{ ansible_env['SUDO_USER'] }}" |
| 48 | mode: 0700 |
| 49 | |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 50 | - name: Ensure known_hosts file is absent |
| 51 | file: |
Zsolt Haraszti | 1504408 | 2016-10-05 00:18:57 -0700 | [diff] [blame] | 52 | path: "{{ ansible_env['HOME'] }}/.ssh/known_hosts" |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 53 | state: absent |
| 54 | |
| 55 | - name: Disable Known Host Checking |
| 56 | copy: |
| 57 | src: files/ssh_config |
Zsolt Haraszti | 1504408 | 2016-10-05 00:18:57 -0700 | [diff] [blame] | 58 | dest: "{{ ansible_env['HOME'] }}/.ssh/config" |
Zsolt Haraszti | 3d16353 | 2016-09-08 15:57:32 -0700 | [diff] [blame] | 59 | owner: "{{ ansible_env['SUDO_USER'] }}" |
| 60 | group: "{{ ansible_env['SUDO_USER'] }}" |
| 61 | mode: 0600 |