Init: mediaserver

This commit is contained in:
2023-02-08 12:13:28 +01:00
parent 848bc9739c
commit f7c23d4ba9
31914 changed files with 6175775 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
# google.cloud.gcloud
This role installs the gcloud command-line tool on a linux system.
## Requirements
### Debian
None
### Ubuntu
None
### CentOS
- epel (if using archive installation)
## Role Variables
All variables which can be overridden are stored in defaults/main.yml file as well as in table below.
| Variable | Required | Default | Comments |
| ------------------------------ | -------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| `gcloud_install_type` | No | `package` | Type of install `package` or `archive` |
| `gcloud_apt_url` | No | `http://packages.cloud.google.com/apt` | URL of the APT Repository |
| `gcloud_apt_key` | No | `https://packages.cloud.google.com/apt/doc/apt-key.gpg` | GPG Key for the APT Repository |
| `gcloud_apt_repo` | No | `cloud-sdk-{{ ansible_distribution_release }}` | Name of the APT Repository |
| `gcloud_yum_baseurl` | No | `https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64` | URL of the YUM Repository |
| `gcloud_yum_key` | No | `https://packages.cloud.google.com/yum/doc/yum-key.gpg` | GPG Key for the YUM Repository |
| `gcloud_version` | No | `268.0.0` | Version of google-cloud-sdk to install |
| `gcloud_archive_name` | No | `google-cloud-sdk-{{ gcloud_version }}-linux-{{ ansible_architecture }}.tar.gz` | Full length name of gcloud archive |
| `gcloud_archive_url` | No | `https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/{{ gcloud_archive_name }}` | URL to download the gcloud archive |
| `gcloud_archive_path` | No | `/usr/lib` | Where should we unpack the archive |
| `gcloud_library_path` | No | `{{ gcloud_archive_path }}/google-cloud-sdk` | Path of the library after archive unpack |
| `gcloud_install_script` | No | `false` | Boolean: Execute install.sh from archive |
| `gcloud_usage_reporting` | No | `false` | Boolean: Disable anonymous usage reporting. |
| `gcloud_profile_path` | No | `false` | Profile to update with PATH and completion. |
| `gcloud_command_completion` | No | `false` | Boolean: Add a line for command completion in the profile |
| `gcloud_update_path` | No | `false` | Boolean: Add a line for path updating in the profile |
| `gcloud_override_components` | No | `[]` | Override the components that would be installed by default |
| `gcloud_additional_components` | No | `[]` | Additional components to installed |
## Example Playbook
```yaml
- hosts: servers
roles:
- role: google.cloud.gcloud
```
## License
MIT
## Author Information
[ericsysmin](https://ericsysmin.com)

View File

@@ -0,0 +1,28 @@
---
# defaults file for gcloud
gcloud_install_type: package
# default values for gcloud apt installation
gcloud_apt_key: https://packages.cloud.google.com/apt/doc/apt-key.gpg
gcloud_apt_url: http://packages.cloud.google.com/apt
gcloud_apt_repo: cloud-sdk
# default values for gcloud yum installation
gcloud_yum_baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
gcloud_yum_key: https://packages.cloud.google.com/yum/doc/yum-key.gpg
# default values for gcloud archive installation
gcloud_version: 268.0.0
gcloud_archive_name: google-cloud-sdk-{{ gcloud_version }}-linux-{{ ansible_architecture }}.tar.gz
gcloud_archive_url: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/{{ gcloud_archive_name }}
gcloud_archive_path: /usr/lib
gcloud_library_path: "{{ gcloud_archive_path }}/google-cloud-sdk"
# values if you want to use the gcloud install script
gcloud_install_script: false
gcloud_usage_reporting: false
gcloud_profile_path: false
gcloud_command_completion: false
gcloud_update_path: false
gcloud_override_components: []
gcloud_additional_components: []

View File

@@ -0,0 +1,20 @@
---
galaxy_info:
role_name: gcloud
author: Eric Anderson
description: Ansible role to install google-cloud-sdk
license: GPL-3.0
min_ansible_version: "2.9"
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- bionic
galaxy_tags:
- gcloud
- google
- cloud
- sdk
dependencies: []

View File

@@ -0,0 +1,53 @@
---
- name: gcloud | Archive | Ensure temp path exists
ansible.builtin.file:
path: "{{ gcloud_archive_path }}"
state: "directory"
mode: "0755"
- name: gcloud | Archive | Extract Cloud SDK archive
ansible.builtin.unarchive:
src: "{{ gcloud_archive_url }}"
dest: "{{ gcloud_archive_path }}"
remote_src: yes
creates: "{{ gcloud_library_path }}"
- name: gcloud | Archive | Link binaries to /usr/bin (like package install)
ansible.builtin.file:
src: "{{ gcloud_library_path }}/bin/{{ item }}"
dest: "/usr/bin/{{ item }}"
state: link
loop:
- bq
- docker-credential-gcloud
- gcloud
- git-credential-gcloud.sh
- gsutil
when: not gcloud_install_script
- name: gcloud | Archive | Add command completion
ansible.builtin.include_tasks: command_completion.yml
when: gcloud_command_completion
- name: gcloud | Archive | Install into Path
ansible.builtin.command: >-
{{ gcloud_archive_path }}/install.sh --quiet
--usage-reporting {{ gcloud_usage_reporting | lower }}
{% if gcloud_profile_path %}
--rc-path {{ gcloud_profile_path }}
{% endif %}
--command-completion {{ gcloud_command_completion | lower }}
--path-update {{ gcloud_update_path | lower }}
{% if gcloud_override_components | length > 0 %}--override-components
{% for component in gcloud_override_components %}{{ component }}
{% if loop.index < gcloud_override_components | length %}
{% endif %}
{% endfor %}
{% endif %}
{% if gcloud_additional_components | length > 0 %}--additional-components
{% for component in gcloud_additional_components %}{{ component }}
{% if loop.index < gcloud_additional_components | length %}
{% endif %}
{% endfor %}
{% endif %}
when: gcloud_install_script

View File

@@ -0,0 +1,34 @@
---
# task file to configure bash completion for gcloud
- name: gcloud | Archive | Debian | Ensure bash completion is installed
ansible.builtin.apt:
name: "bash-completion"
register: task_result
until: task_result is success
retries: 10
delay: 2
when: ansible_os_family == "Debian"
- name: gcloud | Archive | RedHat | Ensure bash completion is installed
ansible.builtin.yum:
name:
- bash-completion
register: task_result
until: task_result is success
retries: 10
delay: 2
when: ansible_os_family == "RedHat"
- name: gcloud | Archive | Ensure bash_completion.d directory exists
ansible.builtin.file:
path: /etc/bash_completion.d
owner: root
group: root
state: directory
mode: 0755
- name: gcloud | Archive | Link binaries to /usr/bin (like package install)
ansible.builtin.file:
src: "{{ gcloud_library_path }}/completion.bash.inc"
dest: /etc/bash_completion.d/gcloud
state: link

View File

@@ -0,0 +1,41 @@
---
# tasks to install gcloud via archive
- name: gcloud | Archive | Look for existing Google Cloud SDK installation
ansible.builtin.stat:
path: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION"
register: gcloud_status
- name: gcloud | Archive | Get gcloud_status
ansible.builtin.debug:
var: "gcloud_status"
- name: gcloud | Archive | Set installed version if installation exists
when: gcloud_status.stat.exists
block:
- name: gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }}
ansible.builtin.slurp:
src: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION"
register: gcloud_installed_version_data
- name: gcloud | Archive | Setting the gcloud_installed_version variable/fact
ansible.builtin.set_fact:
gcloud_installed_version: "{{ (gcloud_installed_version_data.content | b64decode | trim) }}"
- name: gcloud | Archive | get the gcloud_installed_version
ansible.builtin.debug:
msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed"
- name: gcloud | Archive | Version already installed
when: gcloud_version == gcloud_installed_version
ansible.builtin.debug:
msg: >-
Skipping installation of google-cloud-sdk version {{ gcloud_version }} when
{{ gcloud_installed_version }} is already installed.
- name: gcloud | Archive | Start installation
when: gcloud_installed_version is undefined or
gcloud_version is version(gcloud_installed_version, '>')
ansible.builtin.include_tasks: archive_install.yml
- name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301
ansible.builtin.command: gcloud components install {{ item }}
register: gcloud_install_comp_status
changed_when: "'All components are up to date.' not in gcloud_install_comp_status.stderr_lines"
loop: "{{ gcloud_additional_components }}"

View File

@@ -0,0 +1,15 @@
---
- name: gcloud | Load Distro and OS specific variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "os/{{ ansible_distribution | lower }}.yml"
- "os/{{ ansible_os_family | lower }}.yml"
- main.yml
paths:
- 'vars'
- name: gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }}
ansible.builtin.include_tasks: "{{ gcloud_install_type }}/main.yml"

View File

@@ -0,0 +1,31 @@
---
# tasks that install gcloud on debian
- name: gcloud | Debian | Add an Apt signing key, uses whichever key is at the URL
ansible.builtin.apt_key:
url: "{{ gcloud_apt_key }}"
state: present
- name: gcloud | Debian | Add the gcloud repository
ansible.builtin.apt_repository:
repo: "deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main"
state: present
filename: google-cloud-sdk
- name: gcloud | Debian | Install the google-cloud-sdk package
ansible.builtin.apt:
name: "google-cloud-sdk"
update_cache: "yes"
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: gcloud | Debian | Install the google-cloud-sdk additional components
ansible.builtin.apt:
name: "google-cloud-sdk-{{ item }}"
update_cache: "yes"
register: task_result
until: task_result is success
retries: 10
delay: 2
loop: "{{ gcloud_additional_components }}"

View File

@@ -0,0 +1,5 @@
---
# tasks file for gcloud
- name: gcloud | Start package installation for specific distro
ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml"

View File

@@ -0,0 +1,32 @@
---
- name: gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL
ansible.builtin.yum_repository:
name: google-cloud-sdk
description: Google Cloud SDK
ansible.builtin.file: google-cloud-sdk
baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled: yes
gpgcheck: yes
repo_gpgcheck: yes
gpgkey:
- https://packages.cloud.google.com/yum/doc/yum-key.gpg
- https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
- name: gcloud | RHEL | Install the google-cloud-sdk package
ansible.builtin.yum:
name: "google-cloud-sdk"
update_cache: "yes"
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: gcloud | Debian | Install the google-cloud-sdk additional components
ansible.builtin.yum:
name: "google-cloud-sdk-{{ item }}"
update_cache: "yes"
register: task_result
until: task_result is success
retries: 10
delay: 2
loop: "{{ gcloud_additional_components }}"

View File

@@ -0,0 +1,38 @@
gcp_http_lb
=========
This role helps you set up a Google Cloud Load Balancer.
Requirements
------------
- requests Python library
- googleauth Python library
Role Variables
--------------
```
gcp_http_lb_backend: the selflink for the backend that this load balancer will be supporting
gcp_project: the name of your gcp project
service_account_file: the path to your service account JSON file
```
Example Playbook
----------------
- hosts: local
vars:
gcp_http_lb_backend: projects/project/zones/us-central1-c/instanceGroups/my-instance-group
roles:
- role: gcp_http_lb
License
-------
GPLv3
Author Information
------------------
Google Inc.

View File

@@ -0,0 +1,14 @@
---
# defaults file for gcp-http-lb
gcp_http_lb_state: present
gcp_http_lb_cdn: true
gcp_http_lb_name_prefix: 'gcp'
# Name schemes for resources being created
gcp_http_lb_globaladdress: "{{gcp_lb_name_prefix}}-globaladdress"
gcp_http_lb_instancegroup: "{{gcp_lb_name_prefix}}-instancegroup"
gcp_http_lb_healthcheck: "{{gcp_lb_name_prefix}}-healthcheck"
gcp_http_lb_backendservice: "{{gcp_lb_name_prefix}}-backendservice"
gcp_http_lb_urlmap: "{{gcp_lb_name_prefix}}-urlmap"
gcp_http_lb_httpproxy: "{{gcp_lb_name_prefix}}-httpproxy"
gcp_http_lb_forwardingrule: "{{gcp_lb_name_prefix}}-forwardingrule"

View File

@@ -0,0 +1,59 @@
galaxy_info:
author: googlecloudplatform
description: Create a HTTP Load Balancer on GCP
company: Google
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: GPLv3
min_ansible_version: 2.7
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@@ -0,0 +1,65 @@
---
- name: create a global address for the load balancer.
gcp_compute_global_address:
name: "{{ gcp_http_lb_globaladdress }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: "{{ gcp_http_lb_state }}"
register: globaladdress
- name: create a http health check to verify lb working
gcp_compute_http_health_check:
name: "{{ gcp_http_lb_healthcheck }}"
healthy_threshold: 10
port: 80
timeout_sec: 2
unhealthy_threshold: 5
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: "{{ gcp_http_lb_state }}"
register: healthcheck
- name: create a backend service
gcp_compute_backend_service:
name: "{{ gcp_http_lb_backendservice }}"
backends:
- group: "{{ gcp_http_lb_backend.selfLink }}"
health_checks:
- "{{ healthcheck.selfLink }}"
enable_cdn: "{{ gcp_http_lb_cdn }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: "{{ gcp_http_lb_state }}"
register: backendservice
- name: create a url map
gcp_compute_url_map:
name: "{{ gcp_http_lb_urlmap }}"
default_service: "{{ backendservice }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: "{{ gcp_http_lb_state }}"
register: urlmap
- name: create a target http proxy
gcp_compute_target_http_proxy:
name: "{{ gcp_http_lb_httpproxy }}"
url_map: "{{ urlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: "{{ gcp_http_lb_state }}"
register: httpproxy
- name: create a global forwarding rule
gcp_compute_global_forwarding_rule:
name: "{{ gcp_http_lb_forwardingrule }}"
ip_address: "{{ globaladdress.address }}"
load_balancing_scheme: "EXTERNAL"
ip_protocol: TCP
port_range: 80-80
target: "{{ httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: "{{ gcp_http_lb_state }}"
register: result

View File

@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- gcp_http_lb

View File

@@ -0,0 +1,12 @@
---
# vars file for gcp-http-lb
vars:
# The backend this LB will be supporting. This will typically be a Instance Group:
# example: projects/sample-project/zones/us-central1-c/instanceGroups/sample-instance-group
gcp_http_lb_backend: your-backend
# The name of your GCP project
gcp_project: your-project
# The kind of authentication you will use (serviceaccount is recommended)
auth_kind: serviceaccount
# The path to your service account file (if using the serviceaccount auth kind)
service_account_file: path-to-service-account-file

View File

@@ -0,0 +1,31 @@
# gcsfuse
This role configures the gcsfuse repository, and installs gcsfuse on your host.
gcsfuse is a user-space file system for working with
[Google Cloud Storage](https://cloud.google.com/storage/).
**Important:** You should run gcsfuse as the user who will be using the file
system, not as the root user. Do not use sudo either.
After installed you can use it to mount by command:
`gcsfuse bucket-name /mount/point`
## Example Playbook
Including an example of how to use your role (for instance, with variables
passed in as parameters) is always nice for users too:
```yaml
- hosts: servers
tasks:
- include_role:
name: google.cloud.gcsfuse
```
## License
GPLv3
## Author Information
[ericsysmin](https://ericsysmin.com)

View File

@@ -0,0 +1,2 @@
---
# defaults file for google.cloud.gcsfuse

View File

@@ -0,0 +1,2 @@
---
# handlers file for google.cloud.gcsfuse

View File

@@ -0,0 +1,20 @@
---
galaxy_info:
role_name: gcsfuse
author: Eric Anderson
description: Ansible role to install gcsfuse
license: GPL-3.0
min_ansible_version: "2.9"
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- bionic
galaxy_tags:
- gcloud
- google
- gcsfuse
- fuse
dependencies: []

View File

@@ -0,0 +1,28 @@
---
- name: gcsfuse | Ensure gpg is installed
ansible.builtin.apt:
name: "gnupg"
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: gcsfuse | Add an apt signing key
ansible.builtin.apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
- name: gcsfuse | Add the apt repository
ansible.builtin.apt_repository:
repo: deb http://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main
state: present
filename: gcsfuse
- name: gcsfuse | Install gcsfuse
ansible.builtin.apt:
name: "gcsfuse"
update_cache: "yes"
register: task_result
until: task_result is success
retries: 10
delay: 2

View File

@@ -0,0 +1,4 @@
---
# tasks file for google.cloud.gcsfuse
- name: Main
ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml"

View File

@@ -0,0 +1,2 @@
---
# vars file for google.cloud.gcsfuse