Additional file for local mirror functionality.
This commit is contained in:
parent
f5a74d8e3c
commit
0f816dc61a
3
mirror.yml
Normal file
3
mirror.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
use_local_mirror: false
|
||||
mirror_nfs: 192.168.255.1:/var/spool/apt-mirror/mirror
|
36
roles/ubuntu-mirror/tasks/local-mirror.yml
Normal file
36
roles/ubuntu-mirror/tasks/local-mirror.yml
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
# Managing when there's a local mirror served via NFS
|
||||
|
||||
- name: Adding required packages
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- nfs-utils
|
||||
- nfs-utils-lib
|
||||
|
||||
- name: Checking if already mounted
|
||||
shell: mount | grep -q "{{ mirror_nfs }}" && echo "Mounted" || true
|
||||
register: chk_mount_nfs
|
||||
changed_when: "'Mounted' not in chk_mount_nfs.stdout"
|
||||
|
||||
|
||||
- name: Creating mountpoint directory
|
||||
file:
|
||||
path: /var/spool/apt-mirror/mirror
|
||||
recurse: yes
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: chk_mount_nfs|changed
|
||||
|
||||
- name: Adding mountpoint to fstab
|
||||
lineinfile:
|
||||
dest: /etc/fstab
|
||||
line: "{{ mirror_nfs }} /var/spool/apt-mirror/mirror nfs4 defaults 0 0"
|
||||
when: chk_mount_nfs|changed
|
||||
|
||||
- name: Mounting share
|
||||
shell: mount /var/spool/apt-mirror/mirror
|
||||
when: chk_mount_nfs|changed
|
Loading…
x
Reference in New Issue
Block a user