diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
commit | a453ac31f3428614cceb99027f8efbdb9258a40b (patch) | |
tree | f61f87408f32a8511cbd91799f9cececb53e0374 /collections-debian-merged/ansible_collections/google/cloud/roles | |
parent | Initial commit. (diff) | |
download | ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.tar.xz ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.zip |
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collections-debian-merged/ansible_collections/google/cloud/roles')
56 files changed, 1118 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/LICENSE b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/LICENSE new file mode 100644 index 00000000..616fc1eb --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Eric Anderson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/README.md b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/README.md new file mode 100644 index 00000000..dfc365a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/README.md @@ -0,0 +1,60 @@ +# ericsysmin.gcloud + +[![Build Status](https://travis-ci.org/ericsysmin/ansible-role-gcloud.svg?branch=master)](https://travis-ci.org/ericsysmin/ansible-role-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: ericsysmin.gcloud +``` + +## License + +MIT + +## Author Information + +[ericsysmin](https://ericsysmin.com) diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/defaults/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/defaults/main.yml new file mode 100644 index 00000000..b5c45344 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/defaults/main.yml @@ -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-{{ ansible_distribution_release }} + +# 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: [] diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/meta/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/meta/main.yml new file mode 100644 index 00000000..50918c4a --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/meta/main.yml @@ -0,0 +1,21 @@ +--- +galaxy_info: + role_name: gcloud + author: Eric Anderson + description: Ansible role to install google-cloud-sdk + company: Avi Networks + license: MIT + min_ansible_version: 2.4 + platforms: + - name: Ubuntu + versions: + - precise + - trusty + - xenial + - bionic + galaxy_tags: + - gcloud + - google + - cloud + - sdk +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/archive_install.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/archive_install.yml new file mode 100644 index 00000000..b1a6606e --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/archive_install.yml @@ -0,0 +1,50 @@ +--- +- name: gcloud | Archive | Ensure temp path exists + file: path={{ gcloud_archive_path }} state=directory + +- name: gcloud | Archive | Extract Cloud SDK archive + 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) + 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 + include_tasks: command_completion.yml + when: gcloud_command_completion + +- name: gcloud | Archive | Install into Path + 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 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/command_completion.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/command_completion.yml new file mode 100644 index 00000000..866dbfb1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/command_completion.yml @@ -0,0 +1,32 @@ +--- +# task file to configure bash completion for gcloud +- name: gcloud | Archive | Debian | Ensure bash completion is installed + 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 + 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 + file: + path: /etc/bash_completion.d + owner: root + group: root + state: directory + +- name: gcloud | Archive | Link binaries to /usr/bin (like package install) + file: + src: "{{ gcloud_library_path }}/completion.bash.inc" + dest: /etc/bash_completion.d/gcloud + state: link diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/main.yml new file mode 100644 index 00000000..7fff4934 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/archive/main.yml @@ -0,0 +1,37 @@ +--- +# tasks to install gcloud via archive +- name: gcloud | Archive | Look for existing Google Cloud SDK installation + stat: + path: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" + register: gcloud_status + +- debug: var=gcloud_status + +- name: gcloud | Archive | Set installed version if installation exists + block: + - name: gcloud | Archive | Importing contents of {{ gcloud_archive_path }}/google-cloud-sdk/VERSION + slurp: + src: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" + register: gcloud_installed_version_data + - name: gcloud | Archive | Setting the gcloud_installed_version variable/fact + set_fact: + gcloud_installed_version: "{{ (gcloud_installed_version_data.content|b64decode|trim) }}" + - debug: + msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed" + - debug: + msg: >- + Skipping installation of google-cloud-sdk version {{ gcloud_version }} when + {{ gcloud_installed_version }} is already installed. + when: gcloud_version == gcloud_installed_version + when: gcloud_status.stat.exists + +- name: gcloud | Archive | Start installation + include_tasks: archive_install.yml + when: gcloud_installed_version is undefined or + gcloud_version is version(gcloud_installed_version, '>') + +- name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 + 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 }}" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/main.yml new file mode 100644 index 00000000..090852f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/main.yml @@ -0,0 +1,15 @@ +--- + +- name: gcloud | Load Distro and OS specific variables + 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 }} + include_tasks: "{{ gcloud_install_type }}/main.yml" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/debian.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/debian.yml new file mode 100644 index 00000000..f38df34b --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/debian.yml @@ -0,0 +1,27 @@ +--- +# tasks that install gcloud on debian +- name: gcloud | Debian | Add an Apt signing key, uses whichever key is at the URL + apt_key: + url: "{{ gcloud_apt_key }}" + state: present + +- name: gcloud | Debian | Add the gcloud repository + 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 + 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 + 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 }}" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/main.yml new file mode 100644 index 00000000..c9b64ee5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/main.yml @@ -0,0 +1,5 @@ +--- +# tasks file for gcloud + +- name: gcloud | Start package installation for specific distro + include_tasks: "{{ ansible_os_family|lower }}.yml" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/redhat.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/redhat.yml new file mode 100644 index 00000000..1a8a17c0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/tasks/package/redhat.yml @@ -0,0 +1,28 @@ +--- +- name: gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL + yum_repository: + name: google-cloud-sdk + description: Google Cloud SDK + 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 + 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 + 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 }}" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/vars/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/vars/main.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcloud/vars/main.yml @@ -0,0 +1 @@ +--- diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/README.md b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/README.md new file mode 100644 index 00000000..901de6e1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/README.md @@ -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. diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/defaults/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/defaults/main.yml new file mode 100644 index 00000000..f705f01d --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/defaults/main.yml @@ -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" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/meta/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/meta/main.yml new file mode 100644 index 00000000..9ee91040 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/meta/main.yml @@ -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. diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tasks/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tasks/main.yml new file mode 100644 index 00000000..8ed8f4d3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tasks/main.yml @@ -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 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tests/inventory b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tests/inventory new file mode 100644 index 00000000..878877b0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tests/test.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tests/test.yml new file mode 100644 index 00000000..341c7a4e --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - gcp_http_lb diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/vars/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/vars/main.yml new file mode 100644 index 00000000..ca9443f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcp_http_lb/vars/main.yml @@ -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 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/README.md b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/README.md new file mode 100644 index 00000000..2da6d4d1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/README.md @@ -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) diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/defaults/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/defaults/main.yml new file mode 100644 index 00000000..f5197714 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for google.cloud.gcsfuse diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/handlers/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/handlers/main.yml new file mode 100644 index 00000000..db9f8ae0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for google.cloud.gcsfuse diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/tasks/debian.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/tasks/debian.yml new file mode 100644 index 00000000..9443524a --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/tasks/debian.yml @@ -0,0 +1,25 @@ +--- +- name: gcsfuse | Ensure gpg is installed + apt: name=gnupg + register: task_result + until: task_result is success + retries: 10 + delay: 2 + +- name: gcsfuse | Add an apt signing key + apt_key: + url: https://packages.cloud.google.com/apt/doc/apt-key.gpg + state: present + +- name: gcsfuse | Add the apt repository + apt_repository: + repo: deb http://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main + state: present + filename: gcsfuse + +- name: gcsfuse | Install gcsfuse + apt: name=gcsfuse update_cache=yes + register: task_result + until: task_result is success + retries: 10 + delay: 2 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/tasks/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/tasks/main.yml new file mode 100644 index 00000000..c5432c54 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/tasks/main.yml @@ -0,0 +1,4 @@ +--- +# tasks file for google.cloud.gcsfuse + +- include_tasks: "{{ ansible_os_family|lower }}.yml" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/vars/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/vars/main.yml new file mode 100644 index 00000000..019372d6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/gcsfuse/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for google.cloud.gcsfuse diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/README.md b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/README.md new file mode 100644 index 00000000..36a6deb0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/README.md @@ -0,0 +1,59 @@ +# stackdriver_logging + +Ansible role to install the Stackdriver Logging Agent. + +## Requirements + +Permissions to Google Cloud API. If running on an old Compute Engine instance or +Compute Engine instances created without the default credentials, then you must +complete the following steps +<https://cloud.google.com/logging/docs/agent/authorization#before_you_begin> + +## Role Variables + +| Variable | Default | Comments | +| ------------------------------ | ------------------------------ | -------------------------------------------------- | +| `stackdriver_log_service_name` | Please see `defaults/main.yml` | Stackdriver service name | +| `stackdriver_log_package_name` | Please see `defaults/main.yml` | Package name of the Stackdriver agent | +| `stackdriver_log_repo_host` | Please see `defaults/main.yml` | Hostname of the repository the package is loacated | +| `stackdriver_log_repo_suffix` | Please see `defaults/main.yml` | Sufffix for the repository ex. `all` | +| `stackdriver_http_proxy` | Undefined | HTTP Proxy for Stackdriver | +| `stackdriver_https_proxy` | Undefined | HTTPS Proxy for Stackdriver | +| `stackdriver_no_proxy` | Undefined | Skip proxy for the local Metadata Server. | + +### Debian Specific + +| Variable | Required | Comments | +| ------------------------------- | ------------------------------ | ---------------------------------------------------- | +| `stackdriver_log_apt_repo_url` | Please see `defaults/main.yml` | APT repository url | +| `stackdriver_log_apt_gpg_key` | Please see `defaults/main.yml` | GPG Key for verifying the APT repository. | +| `stackdriver_log_apt_repo_name` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | + +### RedHat Specific + +| Variable | Required | Comments | +| ------------------------------- | ------------------------------ | ---------------------------------------------------- | +| `stackdriver_log_yum_repo_url` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_log_yum_repo_name` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_log_yum_repo` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_log_yum_gpg_key` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_log_service_name` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | + +## Dependencies + +## Example Playbook + +```yaml +- hosts: localhost + become: yes + roles: + - role: google.cloud.stackdriver_logging +``` + +## License + +GPLv3 + +## Author Information + +[Eric Anderson](https://ericsysmin.com) diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/defaults/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/defaults/main.yml new file mode 100644 index 00000000..a46371d5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/defaults/main.yml @@ -0,0 +1,26 @@ +--- +# defaults file for stackdriver_logging + +stackdriver_log_service_name: google-fluentd +stackdriver_log_package_name: google-fluentd +stackdriver_log_config_type: unstructured +stackdriver_log_config_name: "{{ 'google-fluentd-catch-all-config' if stackdriver_log_config_type == 'unstructured' \ + else 'google-fluentd-catch-all-config-structured' }}" +stackdriver_log_catch_all_conf: true +stackdriver_log_repo_host: packages.cloud.google.com +stackdriver_log_repo_suffix_value: "{{ '-' ~ stackdriver_log_repo_suffix if stackdriver_log_repo_suffix is defined else '' }}" + +# debian package +stackdriver_log_apt_repo_url: https://{{ stackdriver_log_repo_host }}/apt +stackdriver_log_apt_gpg_key: "{{ stackdriver_log_apt_repo_url }}/doc/apt-key.gpg" +stackdriver_log_apt_repo_name: >- + google-cloud-logging-wheezy{{ stackdriver_log_repo_suffix_value }} + +# yum package +stackdriver_log_yum_repo_url: https://{{ stackdriver_log_repo_host }}/yum +stackdriver_log_yum_repo_name: >- + google-cloud-monitoring-el{{ ansible_distribution_major_version }}-{{ ansible_architecture }}{{ stackdriver_log_repo_suffix_value }} +stackdriver_log_yum_repo: "{{ stackdriver_log_yum_repo_url }}/repos/{{ stackdriver_log_yum_repo_name }}" +stackdriver_log_yum_gpg_key: + - "{{ stackdriver_log_yum_repo_url }}/doc/yum-key.gpg" + - "{{ stackdriver_log_yum_repo_url }}/doc/rpm-package-key.gpg" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/handlers/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/handlers/main.yml new file mode 100644 index 00000000..7a65d55b --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/handlers/main.yml @@ -0,0 +1,5 @@ +--- +# handlers file for stackdriver_logging + +- name: Stackdriver Logging | Restart Stackdriver Agent + service: name={{ stackdriver_log_service_name }} state=restarted diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/meta/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/meta/main.yml new file mode 100644 index 00000000..b1a5aefa --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/meta/main.yml @@ -0,0 +1,20 @@ +--- +galaxy_info: + author: ericsysmin + role_name: stackdriver_logging + description: Ansible role to install Stackdriver logging agent + license: Apache-2.0 + min_ansible_version: 2.8 + platforms: + - name: EL + versions: + - 6 + - 7 + - 8 + - name: Ubuntu + versions: + - precise + - trusty + - xenial + galaxy_tags: [] +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/.ansible-lint b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/.ansible-lint new file mode 100644 index 00000000..e74e0963 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/.ansible-lint @@ -0,0 +1,6 @@ +--- +parseable: true +skip_list: + - ANSIBLE0010 +use_default_rules: true +verbosity: 1 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/.yamllint b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/.yamllint new file mode 100644 index 00000000..ad0be760 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/.yamllint @@ -0,0 +1,11 @@ +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable + truthy: disable diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/Dockerfile.j2 b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/Dockerfile.j2 new file mode 100644 index 00000000..0de39e63 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/Dockerfile.j2 @@ -0,0 +1,22 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +{% if item.env is defined %} +{% for var, value in item.env.items() %} +{% if value %} +ENV {{ var }} {{ value }} +{% endif %} +{% endfor %} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/molecule.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/molecule.yml new file mode 100644 index 00000000..a164da98 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/molecule.yml @@ -0,0 +1,27 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: + name: yamllint + options: + config-file: molecule/default/.yamllint +platforms: + - name: instance + image: ${MOLECULE_DISTRO} + privileged: true + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro +provisioner: + name: ansible + lint: + name: ansible-lint + options: + c: molecule/default/.ansible-lint +scenario: + name: default +verifier: + name: testinfra + lint: + name: flake8 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/playbook.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/playbook.yml new file mode 100644 index 00000000..81a5f1da --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: stackdriver_logging diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/tests/test_default.py b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/tests/test_default.py new file mode 100644 index 00000000..01ddd3ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/molecule/default/tests/test_default.py @@ -0,0 +1,17 @@ +from __future__ import (absolute_import, division, print_function) +import os +import testinfra.utils.ansible_runner + +__metaclass__ = type + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE'] +).get_hosts('all') + + +def test_hosts_file(host): + f = host.file('/etc/hosts') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/debian.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/debian.yml new file mode 100644 index 00000000..f7b79b6a --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/debian.yml @@ -0,0 +1,25 @@ +--- +- name: Stackdriver Logging | Debian | Add the Stackdriver repository + apt_repository: + repo: "deb {{ stackdriver_log_apt_repo_url }} {{ stackdriver_log_apt_repo_name }} main" + filename: google-cloud-logging + state: present + +- name: Stackdriver Logging | Debian | Ensure Stackdriver's GPG key is available. + apt_key: + url: "{{ stackdriver_log_apt_repo_url }}/doc/apt-key.gpg" + state: present + +- name: Stackdriver Logging | Debian | Install the Stackdriver agent + apt: + name: "{{ stackdriver_log_package_name }}" + state: present + update_cache: yes + notify: Stackdriver Logging | Restart Stackdriver Agent + +- name: Stackdriver Logging | Debian | Install the Stackdriver catch all config + apt: + name: "{{ stackdriver_log_config_name }}" + state: present + update_cache: yes + when: stackdriver_log_catch_all_conf diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/main.yml new file mode 100644 index 00000000..892bdda3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/main.yml @@ -0,0 +1,20 @@ +--- +# tasks file for stackdriver_logging + +- name: Stackdriver Logging | OS Based Installation + include_tasks: "{{ ansible_os_family|lower }}.yml" + +- name: Stackdriver Logging | Install the Stackdriver defaults file + template: + src: default/google-fluentd + dest: /etc/default/google-fluentd + when: stackdriver_http_proxy is defined or + stackdriver_https_proxy is defined + +- name: Stackdriver Logging | Install the logging files + template: + src: source.conf + dest: /etc/google-fluentd/config.d/{{ item.name }}.conf + loop: "{{ stackdriver_log_files }}" + when: stackdriver_log_files is defined + notify: Stackdriver Logging | Restart Stackdriver Agent diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/redhat.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/redhat.yml new file mode 100644 index 00000000..ebd4e6ce --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/tasks/redhat.yml @@ -0,0 +1,20 @@ +--- +- name: Stackdriver Logging | RedHat | Install the Python bindings for SELinux + yum: name=libselinux-python state=present + +- name: Stackdriver Logging | RedHat | Add the Stackdriver repository + yum_repository: + name: google-cloud-logging + description: Google Cloud Logging Agent Repository + baseurl: "{{ stackdriver_log_yum_repo }}" + file: google-cloud-logging + enabled: yes + gpgcheck: yes + repo_gpgcheck: yes + gpgkey: "{{ stackdriver_log_yum_gpg_key }}" + +- name: Stackdriver Logging | RedHat | Install Stackdriver agent + yum: + name: "{{ stackdriver_log_package_name }}" + state: present + notify: Stackdriver Logging | Restart Stackdriver Agent diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/templates/default/google-fluentd b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/templates/default/google-fluentd new file mode 100644 index 00000000..c83cbfc7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/templates/default/google-fluentd @@ -0,0 +1,8 @@ +# {{ ansible_managed }} +{% if stackdriver_http_proxy is defined %} +export http_proxy="{{ stackdriver_http_proxy }}" +{% endif %} +{% if stackdriver_https_proxy is defined %} +export https_proxy="{{ stackdriver_https_proxy }}" +{% endif %} +export no_proxy==169.254.169.254 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/templates/source.conf b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/templates/source.conf new file mode 100644 index 00000000..43e7e478 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/templates/source.conf @@ -0,0 +1,11 @@ +# {{ ansible_managed }} +{% for source in item.sources %} +<source> + @type tail + format {{ source.format }} + path {{ source.path }} + pos_file {{ source.pos_file }} + read_from_head {{ source.read_from_head|string|lower }} + tag {{ source.tag }} +</source> +{% endfor %} diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/vars/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/vars/main.yml new file mode 100644 index 00000000..7a758048 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_logging/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for stackdriver_logging diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/README.md b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/README.md new file mode 100644 index 00000000..313f9637 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/README.md @@ -0,0 +1,60 @@ +# stackdriver_monitoring + +Ansible role to install the Stackdriver Logging Agent. + +## Requirements + +Permissions to Google Cloud API. If running on an old Compute Engine instance or +Compute Engine instances created without the default credentials, then you must +complete the following steps +<https://cloud.google.com/monitoring/agent/authorization#before_you_begin> + +## Role Variables + +| Variable | Default | Comments | +| ------------------------------ | ------------------------------ | -------------------------------------------------- | +| `stackdriver_mon_service_name` | Please see `defaults/main.yml` | Stackdriver service name | +| `stackdriver_mon_package_name` | Please see `defaults/main.yml` | Package name of the Stackdriver agent | +| `stackdriver_mon_repo_host` | Please see `defaults/main.yml` | Hostname of the repository the package is loacated | +| `stackdriver_mon_repo_suffix` | Please see `defaults/main.yml` | Sufffix for the repository ex. `all` | +| `stackdriver_http_proxy` | Undefined | HTTP Proxy for Stackdriver | +| `stackdriver_https_proxy` | Undefined | HTTPS Proxy for Stackdriver | +| `stackdriver_no_proxy` | Undefined | Skip proxy for the local Metadata Server. | + +### Debian Specific + +| Variable | Required | Comments | +| ------------------------------- | ------------------------------ | ---------------------------------------------------- | +| `stackdriver_mon_apt_repo_url` | Please see `defaults/main.yml` | APT repository url | +| `stackdriver_mon_apt_gpg_key` | Please see `defaults/main.yml` | GPG Key for verifying the APT repository. | +| `stackdriver_mon_apt_repo_name` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | + +### RedHat Specific + +| Variable | Required | Comments | +| ------------------------------- | ------------------------------ | ---------------------------------------------------- | +| `stackdriver_mon_yum_repo_url` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_mon_yum_repo_name` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_mon_yum_repo` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_mon_yum_gpg_key` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | +| `stackdriver_mon_service_name` | Please see `defaults/main.yml` | Skips any requirements for disk space, ram, and cpu. | + +## Dependencies + +## Example Playbook + +```yaml +- hosts: localhost + become: yes + tasks: + - include_role: + name: google.cloud.stackdriver_monitoring +``` + +## License + +GPLv3 + +## Author Information + +[Eric Anderson](https://ericsysmin.com) diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/defaults/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/defaults/main.yml new file mode 100644 index 00000000..095e8394 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/defaults/main.yml @@ -0,0 +1,20 @@ +--- +# defaults file for stackdriver_monitoring + +stackdriver_mon_service_name: stackdriver-agent +stackdriver_mon_package_name: stackdriver-agent +stackdriver_mon_repo_host: packages.cloud.google.com +stackdriver_mon_repo_suffix: all + +# debian package +stackdriver_mon_apt_repo_url: https://{{ stackdriver_mon_repo_host }}/apt +stackdriver_mon_apt_gpg_key: "{{ stackdriver_mon_apt_repo_url }}/doc/apt-key.gpg" +stackdriver_mon_apt_repo_name: google-cloud-monitoring-{{ ansible_lsb.codename }}-{{ stackdriver_mon_repo_suffix }} + +# yum package +stackdriver_mon_yum_repo_url: https://{{ stackdriver_mon_repo_host }}/yum +stackdriver_mon_yum_repo_name: google-cloud-monitoring-el{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-{{ stackdriver_mon_repo_suffix }} +stackdriver_mon_yum_repo: "{{ stackdriver_mon_yum_repo_url }}/repos/{{ stackdriver_mon_yum_repo_name }}" +stackdriver_mon_yum_gpg_key: + - "{{ stackdriver_mon_yum_repo_url }}/doc/yum-key.gpg" + - "{{ stackdriver_mon_yum_repo_url }}/doc/rpm-package-key.gpg" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/handlers/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/handlers/main.yml new file mode 100644 index 00000000..1d5add9e --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/handlers/main.yml @@ -0,0 +1,5 @@ +--- +# handlers file for stackdriver_monitoring + +- name: Stackdriver Monitoring | Restart Stackdriver Agent + service: name={{ stackdriver_mon_service_name }} state=restarted diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/meta/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/meta/main.yml new file mode 100644 index 00000000..3c0a883e --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/meta/main.yml @@ -0,0 +1,20 @@ +--- +galaxy_info: + author: ericsysmin + role_name: stackdriver_monitoring + description: Ansible role to install Stackdriver monitoring agent + license: Apache-2.0 + min_ansible_version: 2.8 + platforms: + - name: EL + versions: + - 6 + - 7 + - 8 + - name: Ubuntu + versions: + - precise + - trusty + - xenial + galaxy_tags: [] +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/.ansible-lint b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/.ansible-lint new file mode 100644 index 00000000..e74e0963 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/.ansible-lint @@ -0,0 +1,6 @@ +--- +parseable: true +skip_list: + - ANSIBLE0010 +use_default_rules: true +verbosity: 1 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/.yamllint b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/.yamllint new file mode 100644 index 00000000..ad0be760 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/.yamllint @@ -0,0 +1,11 @@ +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable + truthy: disable diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/Dockerfile.j2 b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/Dockerfile.j2 new file mode 100644 index 00000000..0de39e63 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/Dockerfile.j2 @@ -0,0 +1,22 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +{% if item.env is defined %} +{% for var, value in item.env.items() %} +{% if value %} +ENV {{ var }} {{ value }} +{% endif %} +{% endfor %} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/molecule.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/molecule.yml new file mode 100644 index 00000000..a164da98 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/molecule.yml @@ -0,0 +1,27 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: + name: yamllint + options: + config-file: molecule/default/.yamllint +platforms: + - name: instance + image: ${MOLECULE_DISTRO} + privileged: true + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro +provisioner: + name: ansible + lint: + name: ansible-lint + options: + c: molecule/default/.ansible-lint +scenario: + name: default +verifier: + name: testinfra + lint: + name: flake8 diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/playbook.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/playbook.yml new file mode 100644 index 00000000..78d7ab29 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: stackdriver_monitoring diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/tests/test_default.py b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/tests/test_default.py new file mode 100644 index 00000000..01ddd3ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/molecule/default/tests/test_default.py @@ -0,0 +1,17 @@ +from __future__ import (absolute_import, division, print_function) +import os +import testinfra.utils.ansible_runner + +__metaclass__ = type + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE'] +).get_hosts('all') + + +def test_hosts_file(host): + f = host.file('/etc/hosts') + + assert f.exists + assert f.user == 'root' + assert f.group == 'root' diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/debian.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/debian.yml new file mode 100644 index 00000000..cd49a9e6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/debian.yml @@ -0,0 +1,18 @@ +--- +- name: Stackdriver Monitoring | Debian | Add the Stackdriver repository + apt_repository: + repo: "deb {{ stackdriver_mon_apt_repo_url }} {{ stackdriver_mon_apt_repo_name }} main" + filename: google-cloud-monitoring + state: present + +- name: Stackdriver Monitoring | Debian | Ensure Stackdriver's GPG key is available. + apt_key: + url: "{{ stackdriver_mon_apt_repo_url }}/doc/apt-key.gpg" + state: present + +- name: Stackdriver Monitoring | Debian | Install the Stackdriver agent + apt: + name: "{{ stackdriver_mon_package_name }}" + state: present + update_cache: yes + notify: Stackdriver Monitoring | Restart Stackdriver Agent diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/main.yml new file mode 100644 index 00000000..ba8ae8ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/main.yml @@ -0,0 +1,5 @@ +--- +# tasks file for stackdriver_monitoring + +- name: Stackdriver Monitoring | OS Based Installation + include_tasks: "{{ ansible_os_family|lower }}.yml" diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/redhat.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/redhat.yml new file mode 100644 index 00000000..6e035aa1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/tasks/redhat.yml @@ -0,0 +1,21 @@ +--- +- name: Stackdriver Monitoring | RedHat | Install the Python bindings for SELinux + yum: name=libselinux-python state=present + +- name: Stackdriver Monitoring | RedHat | Add the Stackdriver repository + yum_repository: + name: google-cloud-monitoring + description: Google Cloud Monitoring Agent Repository + baseurl: "{{ stackdriver_mon_yum_repo }}" + file: google-cloud-monitoring + enabled: yes + gpgcheck: yes + repo_gpgcheck: yes + gpgkey: "{{ stackdriver_mon_yum_gpg_key }}" + + +- name: Stackdriver Monitoring | RedHat | Install Stackdriver agent + yum: + name: "{{ stackdriver_mon_package_name }}" + state: present + notify: Stackdriver Monitoring | Restart Stackdriver Agent diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/templates/default/stackdriver-agent b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/templates/default/stackdriver-agent new file mode 100644 index 00000000..0b33463e --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/templates/default/stackdriver-agent @@ -0,0 +1,9 @@ +{% if stackdriver_http_proxy is defined %} +export http_proxy="{{ stackdriver_http_proxy }}" +{% endif %} +{% if stackdriver_https_proxy is defined %} +export https_proxy="{{ stackdriver_https_proxy }}" +{% endif %} +{% if stackdriver_no_proxy %} +export no_proxy==169.254.169.254 +{% endif %} diff --git a/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/vars/main.yml b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/vars/main.yml new file mode 100644 index 00000000..29e01cc5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/google/cloud/roles/stackdriver_monitoring/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for stackdriver_monitoring |