(playbook)ubuntu下ansible安装docker

Posted y139147

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(playbook)ubuntu下ansible安装docker相关的知识,希望对你有一定的参考价值。

 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

不具备什么实际意义,只是一次练习记录

以上是关于(playbook)ubuntu下ansible安装docker的主要内容,如果未能解决你的问题,请参考以下文章

ansible-playbook 远程安装nginx

自动运维化工具Ansible使用详解(下)| Playbook

Ansible Try it - 枯鱼的博客

Ansible7:Playbook常用模块

ansible-playbook实现Apache批量部署

学习ansible playbook之前先了解下YAML语法