Additional file for local mirror functionality.

This commit is contained in:
Emiliano Vavassori 2015-10-31 00:56:28 +01:00
parent f5a74d8e3c
commit 0f816dc61a
2 changed files with 39 additions and 0 deletions

3
mirror.yml Normal file
View File

@ -0,0 +1,3 @@
---
use_local_mirror: false
mirror_nfs: 192.168.255.1:/var/spool/apt-mirror/mirror

View 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