eval: wip

This commit is contained in:
2020-10-02 13:57:10 +02:00
parent 544524458c
commit 8ed3b43b5b
2 changed files with 49 additions and 0 deletions

12
eval.sh Normal file
View File

@@ -0,0 +1,12 @@
#! /bin/bash
# this script is meant to be run by ansible
source functions.sh
# check that alias has been tried
addHeader
fileMustExist /etc/httpd.conf.d/cours.opendoor.fr/conf
dirMustExist /srv/cours/www
dirMustExist /srv/cours/logs
pkgInstalled httpd
serviceIsEnabled httpd
serviceIsActive httpd

37
eval.yml Normal file
View File

@@ -0,0 +1,37 @@
---
- hosts:
- b2
user: root
gather_facts: false
vars:
result_file: "tp_apache"
pre_tasks:
- name: insert header
lineinfile:
path: "{{ result_file }}"
line: "machine\tuser\tconffile\twebdir\tlogdir\tpkg\tservice enabled\tservice activated"
state: present
create: true
delegate_to: localhost
tasks:
- name: copy script
copy:
src: "{{ item }}"
dest: /root
mode: 0700
loop:
- functions.sh
- eval.sh
- name: exec script
command: /root/eval.sh
register: result
- name: get result
lineinfile:
path: "{{ result_file }}"
line: "{{ result.stdout }}"
create: true
delegate_to: localhost