ansible: make docker remotely accessible
This commit is contained in:
parent
b9dac2daaa
commit
294a782a9b
@ -23,3 +23,5 @@ common_base_packages:
|
|||||||
- virtualenv
|
- virtualenv
|
||||||
- vim
|
- vim
|
||||||
- whois
|
- whois
|
||||||
|
- jq
|
||||||
|
- net-tools
|
||||||
@ -1,3 +1,4 @@
|
|||||||
[workers]
|
[workers]
|
||||||
vm-jenkins-100-30 ansible_host=192.168.100.30 ansible_user=tylen
|
vm-jenkins-100-30 ansible_host=192.168.100.30 ansible_user=tylen
|
||||||
vm-tools-100-55 ansible_host=192.168.100.55 ansible_user=tylen
|
vm-tools-100-55 ansible_host=192.168.100.55 ansible_user=tylen
|
||||||
|
vm-tools-100-65 ansible_host=192.168.100.65 ansible_user=tylen
|
||||||
@ -30,6 +30,23 @@
|
|||||||
state: latest
|
state: latest
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Ensure the Docker service file is backed up
|
||||||
|
copy:
|
||||||
|
src: /lib/systemd/system/docker.service
|
||||||
|
dest: /lib/systemd/system/docker.service.bak
|
||||||
|
remote_src: yes
|
||||||
|
when: ansible_distribution == "Ubuntu"
|
||||||
|
|
||||||
|
- name: Update ExecStart in Docker service file with exposing the port
|
||||||
|
lineinfile:
|
||||||
|
path: /lib/systemd/system/docker.service
|
||||||
|
regexp: '^ExecStart='
|
||||||
|
line: 'ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375'
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Reload systemd to apply changes
|
||||||
|
command: systemctl daemon-reload
|
||||||
|
|
||||||
- name: Start and enable Docker
|
- name: Start and enable Docker
|
||||||
service:
|
service:
|
||||||
name: docker
|
name: docker
|
||||||
|
|||||||
@ -16,7 +16,14 @@
|
|||||||
|
|
||||||
- name: Create remote-apps directory
|
- name: Create remote-apps directory
|
||||||
file:
|
file:
|
||||||
path: "{{ mount_path }}"
|
path: "{{ remote_apps_mount_path }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ vm_username }}"
|
||||||
|
group: "{{ vm_username }}"
|
||||||
|
|
||||||
|
- name: Create Media directory
|
||||||
|
file:
|
||||||
|
path: "{{ media_mount_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ vm_username }}"
|
owner: "{{ vm_username }}"
|
||||||
group: "{{ vm_username }}"
|
group: "{{ vm_username }}"
|
||||||
@ -32,7 +39,13 @@
|
|||||||
- name: Add ~/remote-apps entry to fstab
|
- name: Add ~/remote-apps entry to fstab
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/fstab
|
dest: /etc/fstab
|
||||||
line: '//{{ nas_ip }}/apps {{ mount_path }} cifs credentials={{ cred_path }}/smb,uid=vm-user 0 0'
|
line: '//{{ nas_ip }}/apps {{ remote_apps_mount_path }} cifs credentials={{ cred_path }}/smb,uid=vm-user 0 0'
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add ~/Media entry to fstab
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/fstab
|
||||||
|
line: '//{{ nas_ip }}/Media {{ media_mount_path }} cifs credentials={{ cred_path }}/smb,uid=vm-user 0 0'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Mount all disks
|
- name: Mount all disks
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
vm_username: vm-user
|
vm_username: vm-user
|
||||||
vm_home: "/home/{{ vm_username }}"
|
vm_home: "/home/{{ vm_username }}"
|
||||||
cred_path: "{{ vm_home }}/.cred"
|
cred_path: "{{ vm_home }}/.cred"
|
||||||
mount_path: "{{ vm_home }}/remote-apps"
|
remote_apps_mount_path: "{{ vm_home }}/remote-apps"
|
||||||
|
media_mount_path: "{{ vm_home }}/Media"
|
||||||
bashrc_mount_path: "{{ vm_home }}/.bashrc"
|
bashrc_mount_path: "{{ vm_home }}/.bashrc"
|
||||||
vimrc_mount_path: "{{ vm_home }}/.vimrc"
|
vimrc_mount_path: "{{ vm_home }}/.vimrc"
|
||||||
Loading…
x
Reference in New Issue
Block a user