-
Notifications
You must be signed in to change notification settings - Fork 8
/
site-uploader.yml
64 lines (58 loc) · 2.7 KB
/
site-uploader.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
################################################################################
# Copyright (c) IBM Corporation 2020, 2021
#
# Description:
# This playbook will prompt you to upload generated HTML to a private
# web-server for local hosting and viewing. On a successful upload the
# playbook will return the URL where the HTML doc is hosted. This takes
# at least 20 minutes to complete. See comments below for improvements.
#
# Note: This has been extracted from the original build because escalated
# privileges have been problematic with Ansible versions greater than 2.10.
# Run this playbook using Ansible 2.9.x
#
# Ideas for improvement:
# - Ping the webserver
# - Check that this playbook is run from the same domain the server is located
# - Upload the documentation as a tar and unzip to increase performance
# Usage:
# ansible-playbook -i inventory site-uploader.yml --ask-vault-pass
################################################################################
---
- hosts: all
gather_facts: no
tasks:
############################################################################
# Confirm that the content should be uploaded (its a slow process)
############################################################################
#- name: Confirm continuing to upload HTML to private Apache server
# pause:
# prompt: "Do you want to upload the generated HTML to an Apache server for review? (y/n)"
# register: deploy_to_web_server_reply
# - name: Confirmation entered
# debug:
# var: deploy_to_web_server_reply
# ############################################################################
# # Deploy HTML to web-server for review if deploy_to_web_server=True
# ############################################################################
- name: Copying files to an Apache server for review
copy:
src: build/html/
dest: /var/www/collection-doc
owner: root
group: root
mode: 0755
force: yes
vars:
ansible_become_password: "{{ webserver_password }}"
delegate_to: "{{ web_server }}"
remote_user: "{{ webserver_user }}"
become: yes
become_user: "{{ webserver_user }}"
become_method: sudo
register: webserver_upload
# when: deploy_to_web_server_reply.user_input == "y"
- name: Uploaded content for internal review.
debug: msg="Successfully uploaded content for review at [ http://{{ web_server }}/index.html ]"
# debug: msg="Successfully uploaded content for review at [ http://collection-doc.{{ web_server }}/index.html ]"
# when: deploy_to_web_server_reply == "y" and webserver_upload and not webserver_upload.failed