(playbook)ubuntuでansibleインストールdocker
4837 ワード
1 ---
2 - hosts: test
3 sudo: yes
4 vars:
5 apt_packages_ca:
6 - apt-transport-https
7 - ca-certificates
8
9 tasks:
10
11 - name: add docker source list file for install docker
12 file:
13 path: /etc/apt/sources.list.d/docker.list
14 state: touch
15 owner: root
16 mode: 'u+r,g+rw'
17
18 - name: write deb url of docker to docker.list
19 blockinfile:
20 dest: /etc/apt/sources.list.d/docker.list
21 marker: ""
22 block: |
23 deb https://apt.dockerproject.org/repo ubuntu-trusty main
24
25 - name: add CA certificates and ensure installed
26 apt:
27 name: "{{ item }}"
28 update_cache: yes
29 with_items: "{{ apt_packages_ca }}"
30
31 - name: add apt-key of dockers
32 apt_key:
33 keyserver: p80.pool.sks-keyservers.net
34 id: 58118E89F3A912897C070ADBF76221572C52609D
35
36 - name: install docker-engine
37 apt:
38 name: docker-engine
39 state: latest
40 force: yes
41 ...
実際の意味がなく、ただの練習記録です.