Skip to content

Instantly share code, notes, and snippets.

View alebsys's full-sized avatar

Aleksandr Lebedev alebsys

View GitHub Profile
<html>
<body>
<h1 align="center">Hello, from ansible managed server!</h1>
<h1 align="center">My VPC IP is {{ hostvars['<YOUR NAME>']['ansible_host'] }}</h1>
<h1 align="center">I love {{ food }}</h1> <!-- Добавим ссылку на нашу переменную-->
</body>
</html>
Создатель роли допустил ошибку.
В файле .imported_role/ansible-role-universal-tomcat/templates/server.xml.j2
нужно обернуть в кавычки версию Tomcat:
{% if tomcat_version_major < '8' %}
---
- name: update apt
apt:
update_cache: yes
- name: install nginx
apt:
name: nginx
state: present
- name: configure nginx
template:
src: default.j2
dest: /etc/nginx/sites-enabled/default
- name: make folder for app
file:
path: /srv/web
state: directory
- name: create index page
template:
src: index.html.j2
dest: /srv/web/index.html
- name: create page for countries
template:
src: countries.html.j2
dest: /srv/web/countries.html
- hosts: web
become: true
roles:
- nginx
---
- name: MongoDB - add pgp key
apt_key:
url: https://www.mongodb.org/static/pgp/server-4.0.asc
state: present
- name: MongoDB - add repository
apt_repository:
filename: '/etc/apt/sources.list.d/mongodb.list'
repo: "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse"