theillien

docky-rocky.yaml

Jul 23rd, 2021 (edited)
1,055
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  - name: Add Docker GPG key
  2.     rpm_key:
  3.       key: "{{ docker_yum_repo_gpg_url }}"
  4.       state: present
  5.  
  6.   - name: Add Docker repository
  7.     get_url:
  8.       url: "{{ docker_yum_repo_url }}"
  9.       dest: '/etc/yum.repos.d/{{ docker_package }}.repo'
  10.       owner: root
  11.       group: root
  12.       mode: 0644
  13.  
  14.   - name: Install Docker
  15.     yum:
  16.       name: "{{ docker_package }}"
  17.       state: "{{ docker_package_state }}"
  18.  
  19.   - name: Enable and start Docker
  20.     service:
  21.       name: docker
  22.       enabled: "{{ docker_service_enabled }}"
  23.       state: "{{ docker_service_state }}"
  24.  
  25.   - name: Create container
  26.       docker_container:
  27.         name: mynginx
  28.         image: nginx
  29.         state: started
  30.  
  31.   - name: Generate a list of running containers
  32.     command: docker ps
  33.     register: dockerps
  34.  
  35.   - name: Display the list of running containers
  36.     debug:
  37.       var: dockerps.stdout
RAW Paste Data