├── .ansible-lint ├── .github ├── renovate.json ├── settings.yml ├── version-drafter.yml └── workflows │ ├── release.yml │ └── test.yml ├── .gitignore ├── .later.yml ├── .yamllint ├── CHANGELOG.md ├── LICENSE ├── README.md ├── defaults └── main.yml ├── handlers └── main.yml ├── meta └── main.yml ├── molecule ├── default │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ │ └── test_default.py ├── download_and_propagate │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ │ ├── conftest.py │ │ └── test_download_and_propagate.py ├── latest │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ │ └── test_latest.py ├── scenario_with_local_binary_directory │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ │ ├── conftest.py │ │ └── test_scenario_with_local_binary_directory.py └── upgrade │ ├── .gitignore │ ├── molecule.yml │ ├── playbook.yml │ ├── prepare.yml │ └── tests │ └── test_upgrade.py ├── tasks ├── install.yml ├── main.yml └── preflight.yml ├── templates ├── config.j2 └── service.j2 ├── test-requirements.txt ├── tox.ini └── vars └── main.yml /.ansible-lint: -------------------------------------------------------------------------------- 1 | --- 2 | skip_list: 3 | - '204' -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base"], 3 | "regexManagers": [ 4 | { 5 | "depNameTemplate": "grafana/loki", 6 | "datasourceTemplate": "github-releases", 7 | "extractVersionTemplate": "^v(?.*)$", 8 | "fileMatch": ["^README\\.md$", "^defaults\\/main\\.yml$"], 9 | "matchStrings": [ 10 | "promtail_version: \"(?.*)\"\\s+", 11 | "\\|\\s+`promtail_version`\\s+\\|\\s+\"(?.*)\"\\s+\\|\\s+.*\\s+\\|\\s+" 12 | ] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | repository: 3 | name: ansible-role-promtail 4 | description: 🔧 Ansible role for deploying promtail 5 | topics: ansible, role, ansible-role, promtail, loki, logging 6 | 7 | private: false 8 | has_issues: true 9 | has_projects: false 10 | has_wiki: false 11 | has_downloads: false 12 | 13 | default_branch: master 14 | 15 | allow_squash_merge: true 16 | allow_merge_commit: true 17 | allow_rebase_merge: true 18 | delete_branch_on_merge: true 19 | 20 | labels: 21 | - name: bug 22 | color: d73a4a 23 | description: Something isn't working 24 | - name: documentation 25 | color: 0075ca 26 | description: Improvements or additions to documentation 27 | - name: duplicate 28 | color: cfd3d7 29 | description: This issue or pull request already exists 30 | - name: enhancement 31 | color: a2eeef 32 | description: New feature or request 33 | - name: good first issue 34 | color: 7057ff 35 | description: Good for newcomers 36 | - name: help wanted 37 | color: 008672 38 | description: Extra attention is needed 39 | - name: invalid 40 | color: e4e669 41 | description: This doesn't seem right 42 | - name: question 43 | color: d876e3 44 | description: Further information is requested 45 | - name: wontfix 46 | color: ffffff 47 | description: This will not be worked on 48 | - name: dependencies 49 | color: 0366d6 50 | description: Pull requests that update a dependency file 51 | - name: security 52 | description: Security relevant changes 53 | color: efc04a 54 | - name: removed 55 | description: Functionality that has been removed 56 | color: e0b862 57 | - name: deprecation 58 | description: Functionality that has been deprecated 59 | color: f9f99d 60 | - name: changed 61 | description: Functionality that has been changed 62 | color: 3ed678 63 | - name: semver:patch 64 | color: 834dd1 65 | description: Change leading to a patch level version bump 66 | - name: semver:minor 67 | color: 764ab5 68 | description: Change leading to a minor level version bump 69 | - name: semver:major 70 | color: 6b3bad 71 | description: A (breaking) change leading to a major version bump 72 | 73 | branches: 74 | - name: master 75 | protection: 76 | required_status_checks: 77 | strict: true 78 | contexts: 79 | - continuous-integration/travis-ci/pr 80 | - continuous-integration/travis-ci/push 81 | enforce_admins: false 82 | restrictions: 83 | users: [] 84 | teams: [] 85 | 86 | ... -------------------------------------------------------------------------------- /.github/version-drafter.yml: -------------------------------------------------------------------------------- 1 | major-labels: ['semver:major'] 2 | minor-labels: ['semver:minor', 'enhancement'] 3 | patch-labels: ['semver:patch', 'bug'] -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: changelog and release automation 2 | on: 3 | push: 4 | branches: 5 | - master 6 | 7 | jobs: 8 | changelog: 9 | runs-on: ubuntu-latest 10 | if: "!contains(github.event.head_commit.message, '[RELEASE]')" 11 | steps: 12 | - uses: actions/checkout@master 13 | - name: calculate next version 14 | id: version 15 | uses: patrickjahns/version-drafter-action@v1 16 | env: 17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | - name: update changelog 19 | uses: patrickjahns/chlgr@v1 20 | with: 21 | release-version: ${{ steps.version.outputs.next-version }} 22 | 23 | release: 24 | runs-on: ubuntu-latest 25 | if: "contains(github.event.head_commit.message, '[RELEASE]')" 26 | steps: 27 | - uses: actions/checkout@master 28 | 29 | - name: extract version from commit message 30 | shell: bash 31 | run: | 32 | VERSION=$(echo "${COMMIT_MSG}" | grep -Po '\d+.\d+.\d+') 33 | CHANGELOG=$(cat CHANGELOG.md | sed -n '/^## \[/{p; :loop n; /^## \[/q; p; b loop}') 34 | CHANGELOG="${CHANGELOG%??}" 35 | CHANGELOG="${CHANGELOG//'%'/'%25'}" 36 | CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" 37 | CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" 38 | echo "version=${VERSION}" >> $GITHUB_OUTPUT 39 | echo "changelog=${CHANGELOG}" >> $GITHUB_OUTPUT 40 | env: 41 | COMMIT_MSG: ${{ github.event.head_commit.message }} 42 | id: version 43 | 44 | - name: create release 45 | env: 46 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 47 | RELEASE_TAG: ${{ steps.version.outputs.version }} 48 | RELASE_NOTES: ${{ steps.version.outputs.changelog }} 49 | run: | 50 | RELASE_NOTES="${RELASE_NOTES//$'%0A'/'\n'}" 51 | echo -e $RELASE_NOTES | gh release create "${RELEASE_TAG}" --title "${RELEASE_TAG}" --notes-file - 52 | 53 | - name: galaxy 54 | uses: robertdebock/galaxy-action@1.2.1 55 | with: 56 | galaxy_api_key: ${{ secrets.galaxy_api_key }} 57 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | branches: 8 | - master 9 | 10 | jobs: 11 | ansible-later: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - name: ansible-later 16 | uses: patrickjahns/ansible-later-action@v1 17 | with: 18 | config: ".later.yml" 19 | path: "**/*.yml" 20 | 21 | molecule: 22 | runs-on: ubuntu-latest 23 | strategy: 24 | fail-fast: false 25 | matrix: 26 | include: 27 | - ANSIBLE: "2.10" 28 | MOLECULE_SCENARIO: default 29 | - ANSIBLE: "3.4" 30 | MOLECULE_SCENARIO: default 31 | - ANSIBLE: "4.10" 32 | MOLECULE_SCENARIO: default 33 | - ANSIBLE: "5.10" 34 | MOLECULE_SCENARIO: default 35 | - ANSIBLE: "6.7" 36 | MOLECULE_SCENARIO: default 37 | - ANSIBLE: "7.7" 38 | MOLECULE_SCENARIO: default 39 | - ANSIBLE: "8.7" 40 | MOLECULE_SCENARIO: default 41 | - ANSIBLE: "9.4" 42 | MOLECULE_SCENARIO: latest 43 | - ANSIBLE: "9.4" 44 | MOLECULE_SCENARIO: upgrade 45 | - ANSIBLE: "9.4" 46 | MOLECULE_SCENARIO: scenario_with_local_binary_directory 47 | - ANSIBLE: "9.4" 48 | MOLECULE_SCENARIO: download_and_propagate 49 | - ANSIBLE: "9.4" 50 | MOLECULE_SCENARIO: default 51 | MOLECULE_DISTRO: ubuntu2004 52 | - ANSIBLE: "9.4" 53 | MOLECULE_SCENARIO: default 54 | MOLECULE_DISTRO: ubuntu2204 55 | - ANSIBLE: "9.4" 56 | MOLECULE_SCENARIO: default 57 | MOLECULE_DISTRO: debian11 58 | - ANSIBLE: "9.4" 59 | MOLECULE_SCENARIO: default 60 | MOLECULE_DISTRO: debian12 61 | - ANSIBLE: "9.4" 62 | MOLECULE_DISTRO: centos8 63 | MOLECULE_SCENARIO: default 64 | - ANSIBLE: "9.4" 65 | MOLECULE_DISTRO: fedora39 66 | MOLECULE_SCENARIO: default 67 | steps: 68 | - uses: actions/checkout@v4 69 | - name: Set up Python 3.10 70 | uses: actions/setup-python@v5 71 | with: 72 | python-version: "3.10" 73 | - name: Install tox 74 | run: | 75 | python -m pip install --upgrade pip 76 | pip list 77 | pip install tox tox-gh-actions 78 | - name: Run molecule 79 | env: 80 | ANSIBLE: ${{ matrix.ANSIBLE }} 81 | MOLECULE_DISTRO: ${{ matrix.MOLECULE_DISTRO }} 82 | MOLECULE_SCENARIO: ${{ matrix.MOLECULE_SCENARIO }} 83 | run: | 84 | tox -- pip list 85 | tox -- molecule test -s ${MOLECULE_SCENARIO} --destroy always 86 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.retry 2 | *.log 3 | .molecule 4 | .cache 5 | __pycache__/ 6 | .pytest_cache 7 | .tox -------------------------------------------------------------------------------- /.later.yml: -------------------------------------------------------------------------------- 1 | --- 2 | rules: 3 | exclude_files: 4 | - .github 5 | - molecule 6 | exclude_filter: 7 | - LINT0009 8 | - ANSIBLE0015 9 | ignore_dotfiles: True 10 | 11 | # based on ansible-galaxy rules 12 | yamllint: 13 | braces: {max-spaces-inside: 1, level: error} 14 | colons: {max-spaces-after: -1, level: error} 15 | commas: {max-spaces-after: -1, level: error} 16 | comments: disable 17 | comments-indentation: disable 18 | empty-lines: {max: 3, level: error} 19 | hyphens: {level: error} 20 | key-duplicates: enable 21 | line-length: disable 22 | new-line-at-end-of-file: disable 23 | new-lines: {type: unix} 24 | trailing-spaces: disable 25 | truthy: disable -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | extends: default 2 | ignore: | 3 | .travis/ 4 | .travis.yml 5 | .github/ 6 | .tox 7 | meta/ 8 | 9 | rules: 10 | # based on ansible-galaxy rules 11 | braces: {max-spaces-inside: 1, level: error} 12 | colons: {max-spaces-after: -1, level: error} 13 | commas: {max-spaces-after: -1, level: error} 14 | comments: disable 15 | comments-indentation: disable 16 | document-start: disable 17 | empty-lines: {max: 3, level: error} 18 | hyphens: {level: error} 19 | indentation: disable 20 | key-duplicates: enable 21 | line-length: disable 22 | new-line-at-end-of-file: disable 23 | new-lines: {type: unix} 24 | trailing-spaces: disable 25 | truthy: disable 26 | 27 | 28 | # Max 1 space in empty brackets 29 | brackets: 30 | min-spaces-inside-empty: 0 31 | max-spaces-inside-empty: 1 32 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.31.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.31.0) (2024-04-24) 4 | 5 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.30.0...1.31.0) 6 | 7 | **Implemented enhancements:** 8 | 9 | - validate templated promtail config file [\#221](https://github.com/patrickjahns/ansible-role-promtail/pull/221) ([patrickjahns](https://github.com/patrickjahns)) 10 | 11 | ## [1.30.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.30.0) (2024-04-24) 12 | 13 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.29.1...1.30.0) 14 | 15 | **Merged pull requests:** 16 | 17 | - chore\(deps\): update dependency grafana/loki to v3 [\#215](https://github.com/patrickjahns/ansible-role-promtail/pull/215) ([renovate[bot]](https://github.com/apps/renovate)) 18 | 19 | ## [1.29.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.29.1) (2024-04-24) 20 | 21 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.29.0...1.29.1) 22 | 23 | **Merged pull requests:** 24 | 25 | - chore\(deps\): update dependency grafana/loki to v2.9.7 [\#216](https://github.com/patrickjahns/ansible-role-promtail/pull/216) ([renovate[bot]](https://github.com/apps/renovate)) 26 | - ci: bumped ansible test versions and base os versions [\#214](https://github.com/patrickjahns/ansible-role-promtail/pull/214) ([patrickjahns](https://github.com/patrickjahns)) 27 | 28 | ## [1.29.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.29.0) (2024-04-08) 29 | 30 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.28.0...1.29.0) 31 | 32 | **Implemented enhancements:** 33 | 34 | - Support arbitrary options in the configuration file [\#203](https://github.com/patrickjahns/ansible-role-promtail/issues/203) 35 | - Add variable \(list\) for additional command line arguments/flags passed to promtail [\#167](https://github.com/patrickjahns/ansible-role-promtail/issues/167) 36 | - feat: add promtail\_extra\_args variable to allow configuring the service arguments [\#207](https://github.com/patrickjahns/ansible-role-promtail/pull/207) ([sfhl](https://github.com/sfhl)) 37 | 38 | **Fixed bugs:** 39 | 40 | - Automatic publishing to Ansible Galaxy is currently broken [\#199](https://github.com/patrickjahns/ansible-role-promtail/issues/199) 41 | 42 | **Merged pull requests:** 43 | 44 | - chore\(deps\): update dependency grafana/loki to v2.9.6 [\#210](https://github.com/patrickjahns/ansible-role-promtail/pull/210) ([renovate[bot]](https://github.com/apps/renovate)) 45 | - chore\(deps\): update dependency setuptools to v69.2.0 [\#209](https://github.com/patrickjahns/ansible-role-promtail/pull/209) ([renovate[bot]](https://github.com/apps/renovate)) 46 | 47 | ## [1.28.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.28.0) (2024-02-14) 48 | 49 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.27.0...1.28.0) 50 | 51 | **Merged pull requests:** 52 | 53 | - ci: bump python version to 3.10 [\#208](https://github.com/patrickjahns/ansible-role-promtail/pull/208) ([patrickjahns](https://github.com/patrickjahns)) 54 | - chore\(deps\): update dependency setuptools to v69.1.0 [\#206](https://github.com/patrickjahns/ansible-role-promtail/pull/206) ([renovate[bot]](https://github.com/apps/renovate)) 55 | - chore\(deps\): update dependency grafana/loki to v2.9.4 [\#202](https://github.com/patrickjahns/ansible-role-promtail/pull/202) ([renovate[bot]](https://github.com/apps/renovate)) 56 | - chore\(deps\): update actions/setup-python action to v5 [\#201](https://github.com/patrickjahns/ansible-role-promtail/pull/201) ([renovate[bot]](https://github.com/apps/renovate)) 57 | - chore\(deps\): update dependency setuptools to v69 [\#200](https://github.com/patrickjahns/ansible-role-promtail/pull/200) ([renovate[bot]](https://github.com/apps/renovate)) 58 | 59 | ## [1.27.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.27.0) (2023-11-05) 60 | 61 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.26.0...1.27.0) 62 | 63 | **Fixed bugs:** 64 | 65 | - promtail\_config\_expand\_env variable is wrong by default [\#187](https://github.com/patrickjahns/ansible-role-promtail/issues/187) 66 | - fix: disable long lines splitting in promtail\_config\_scrape\_configs [\#197](https://github.com/patrickjahns/ansible-role-promtail/pull/197) ([niasar](https://github.com/niasar)) 67 | - Updated `config.expand-env` related variable and templating [\#194](https://github.com/patrickjahns/ansible-role-promtail/pull/194) ([azhinu](https://github.com/azhinu)) 68 | 69 | **Closed issues:** 70 | 71 | - unable to parse syslog config receiver [\#196](https://github.com/patrickjahns/ansible-role-promtail/issues/196) 72 | 73 | **Merged pull requests:** 74 | 75 | - chore\(deps\): update dependency grafana/loki to v2.9.2 [\#195](https://github.com/patrickjahns/ansible-role-promtail/pull/195) ([renovate[bot]](https://github.com/apps/renovate)) 76 | - chore\(deps\): update dependency setuptools to v68.2.2 [\#191](https://github.com/patrickjahns/ansible-role-promtail/pull/191) ([renovate[bot]](https://github.com/apps/renovate)) 77 | 78 | ## [1.26.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.26.0) (2023-09-14) 79 | 80 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.25.0...1.26.0) 81 | 82 | **Merged pull requests:** 83 | 84 | - chore\(deps\): update dependency grafana/loki to v2.9.1 [\#192](https://github.com/patrickjahns/ansible-role-promtail/pull/192) ([renovate[bot]](https://github.com/apps/renovate)) 85 | 86 | ## [1.25.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.25.0) (2023-09-14) 87 | 88 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.24.1...1.25.0) 89 | 90 | **Merged pull requests:** 91 | 92 | - chore\(deps\): update dependency grafana/loki to v2.9.0 [\#189](https://github.com/patrickjahns/ansible-role-promtail/pull/189) ([renovate[bot]](https://github.com/apps/renovate)) 93 | - chore\(deps\): update actions/checkout action to v4 [\#188](https://github.com/patrickjahns/ansible-role-promtail/pull/188) ([renovate[bot]](https://github.com/apps/renovate)) 94 | - chore\(deps\): update dependency setuptools to v68 [\#183](https://github.com/patrickjahns/ansible-role-promtail/pull/183) ([renovate[bot]](https://github.com/apps/renovate)) 95 | 96 | ## [1.24.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.24.1) (2023-08-12) 97 | 98 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.24.0...1.24.1) 99 | 100 | **Merged pull requests:** 101 | 102 | - chore\(deps\): update dependency grafana/loki to v2.8.4 [\#184](https://github.com/patrickjahns/ansible-role-promtail/pull/184) ([renovate[bot]](https://github.com/apps/renovate)) 103 | 104 | ## [1.24.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.24.0) (2023-05-12) 105 | 106 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.23.1...1.24.0) 107 | 108 | **Closed issues:** 109 | 110 | - Update release pipeline \(before Jun 23\) [\#163](https://github.com/patrickjahns/ansible-role-promtail/issues/163) 111 | 112 | **Merged pull requests:** 113 | 114 | - ci: updated release pipeline to fix deprecated github action usages [\#180](https://github.com/patrickjahns/ansible-role-promtail/pull/180) ([patrickjahns](https://github.com/patrickjahns)) 115 | - chore\(deps\): update dependency grafana/loki to v2.8.2 [\#176](https://github.com/patrickjahns/ansible-role-promtail/pull/176) ([renovate[bot]](https://github.com/apps/renovate)) 116 | 117 | ## [1.23.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.23.1) (2023-04-25) 118 | 119 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.23.0...1.23.1) 120 | 121 | **Merged pull requests:** 122 | 123 | - chore\(deps\): update dependency grafana/loki to v2.8.1 [\#174](https://github.com/patrickjahns/ansible-role-promtail/pull/174) ([renovate[bot]](https://github.com/apps/renovate)) 124 | 125 | ## [1.23.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.23.0) (2023-04-05) 126 | 127 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.22.3...1.23.0) 128 | 129 | **Implemented enhancements:** 130 | 131 | - feat: download binaries to ansible controller and copy to nodes [\#128](https://github.com/patrickjahns/ansible-role-promtail/pull/128) ([gannaramu](https://github.com/gannaramu)) 132 | 133 | **Merged pull requests:** 134 | 135 | - chore\(deps\): update dependency grafana/loki to v2.8.0 [\#171](https://github.com/patrickjahns/ansible-role-promtail/pull/171) ([renovate[bot]](https://github.com/apps/renovate)) 136 | 137 | ## [1.22.3](https://github.com/patrickjahns/ansible-role-promtail/tree/1.22.3) (2023-03-31) 138 | 139 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.22.2...1.22.3) 140 | 141 | **Merged pull requests:** 142 | 143 | - chore\(deps\): update dependency grafana/loki to v2.7.5 [\#168](https://github.com/patrickjahns/ansible-role-promtail/pull/168) ([renovate[bot]](https://github.com/apps/renovate)) 144 | 145 | ## [1.22.2](https://github.com/patrickjahns/ansible-role-promtail/tree/1.22.2) (2023-02-25) 146 | 147 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.22.1...1.22.2) 148 | 149 | **Merged pull requests:** 150 | 151 | - chore\(deps\): update dependency grafana/loki to v2.7.4 [\#165](https://github.com/patrickjahns/ansible-role-promtail/pull/165) ([renovate[bot]](https://github.com/apps/renovate)) 152 | 153 | ## [1.22.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.22.1) (2023-02-20) 154 | 155 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.22.0...1.22.1) 156 | 157 | **Fixed bugs:** 158 | 159 | - Revert back to fetching of version information from localhost [\#162](https://github.com/patrickjahns/ansible-role-promtail/pull/162) ([mprasil](https://github.com/mprasil)) 160 | 161 | **Closed issues:** 162 | 163 | - latest Tag: failing at downloading SHA256SUMS [\#76](https://github.com/patrickjahns/ansible-role-promtail/issues/76) 164 | - \[Discussion\] Add loki installation mechanism \(opt-in, additional to promtail\) [\#58](https://github.com/patrickjahns/ansible-role-promtail/issues/58) 165 | 166 | **Merged pull requests:** 167 | 168 | - chore\(deps\): update dependency setuptools to v67.3.2 [\#161](https://github.com/patrickjahns/ansible-role-promtail/pull/161) ([renovate[bot]](https://github.com/apps/renovate)) 169 | - fix: fail early when using promtail\_binary\_local\_dir [\#158](https://github.com/patrickjahns/ansible-role-promtail/pull/158) ([patrickjahns](https://github.com/patrickjahns)) 170 | 171 | ## [1.22.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.22.0) (2023-02-10) 172 | 173 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.21.0...1.22.0) 174 | 175 | **Implemented enhancements:** 176 | 177 | - feat: add var promtail\_binary\_local\_dir [\#104](https://github.com/patrickjahns/ansible-role-promtail/pull/104) ([OuiSouss](https://github.com/OuiSouss)) 178 | 179 | **Merged pull requests:** 180 | 181 | - chore\(deps\): update dependency setuptools to v67.2.0 [\#156](https://github.com/patrickjahns/ansible-role-promtail/pull/156) ([renovate[bot]](https://github.com/apps/renovate)) 182 | 183 | ## [1.21.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.21.0) (2023-02-01) 184 | 185 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.20.0...1.21.0) 186 | 187 | **Implemented enhancements:** 188 | 189 | - chore\(deps\): update dependency grafana/loki to v2.7.3 [\#151](https://github.com/patrickjahns/ansible-role-promtail/pull/151) ([renovate[bot]](https://github.com/apps/renovate)) 190 | 191 | **Closed issues:** 192 | 193 | - Reenable version check for default tests [\#135](https://github.com/patrickjahns/ansible-role-promtail/issues/135) 194 | 195 | **Merged pull requests:** 196 | 197 | - test: fix tox configuration [\#153](https://github.com/patrickjahns/ansible-role-promtail/pull/153) ([patrickjahns](https://github.com/patrickjahns)) 198 | - chore\(deps\): update dependency setuptools to v67 [\#152](https://github.com/patrickjahns/ansible-role-promtail/pull/152) ([renovate[bot]](https://github.com/apps/renovate)) 199 | 200 | ## [1.20.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.20.0) (2022-12-10) 201 | 202 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.19.2...1.20.0) 203 | 204 | **Merged pull requests:** 205 | 206 | - chore\(deps\): update dependency grafana/loki to v2.7.1 [\#146](https://github.com/patrickjahns/ansible-role-promtail/pull/146) ([renovate[bot]](https://github.com/apps/renovate)) 207 | - chore\(deps\): update dependency molecule to v4.0.4 [\#145](https://github.com/patrickjahns/ansible-role-promtail/pull/145) ([renovate[bot]](https://github.com/apps/renovate)) 208 | - fix\(renovate\): major rewrite by removing duplicates [\#144](https://github.com/patrickjahns/ansible-role-promtail/pull/144) ([MindTooth](https://github.com/MindTooth)) 209 | 210 | ## [1.19.2](https://github.com/patrickjahns/ansible-role-promtail/tree/1.19.2) (2022-11-28) 211 | 212 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.19.1...1.19.2) 213 | 214 | **Fixed bugs:** 215 | 216 | - Remove home parameter in user task [\#143](https://github.com/patrickjahns/ansible-role-promtail/pull/143) ([hafu](https://github.com/hafu)) 217 | 218 | **Closed issues:** 219 | 220 | - 1.19.1 no longer works: user promtail is currently used by process 546 [\#140](https://github.com/patrickjahns/ansible-role-promtail/issues/140) 221 | 222 | **Merged pull requests:** 223 | 224 | - test: added tests for catching role upgrade issues [\#141](https://github.com/patrickjahns/ansible-role-promtail/pull/141) ([patrickjahns](https://github.com/patrickjahns)) 225 | - chore\(deps\): update dependency setuptools to v65.6.3 [\#137](https://github.com/patrickjahns/ansible-role-promtail/pull/137) ([renovate[bot]](https://github.com/apps/renovate)) 226 | 227 | ## [1.19.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.19.1) (2022-11-25) 228 | 229 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.19.0...1.19.1) 230 | 231 | **Merged pull requests:** 232 | 233 | - Set promtail user home to install directory [\#138](https://github.com/patrickjahns/ansible-role-promtail/pull/138) ([hafu](https://github.com/hafu)) 234 | 235 | ## [1.19.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.19.0) (2022-11-18) 236 | 237 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.18.0...1.19.0) 238 | 239 | **Implemented enhancements:** 240 | 241 | - chore\(deps\): update dependency grafana/loki to v2.7.0 [\#134](https://github.com/patrickjahns/ansible-role-promtail/pull/134) ([renovate[bot]](https://github.com/apps/renovate)) 242 | - add var to control promtail config env var expansion [\#132](https://github.com/patrickjahns/ansible-role-promtail/pull/132) ([rplevka](https://github.com/rplevka)) 243 | 244 | **Closed issues:** 245 | 246 | - Make LimitNOFILE in systemd service configurable [\#129](https://github.com/patrickjahns/ansible-role-promtail/issues/129) 247 | - run\_once causes failures when not all nodes in batch get promtail [\#112](https://github.com/patrickjahns/ansible-role-promtail/issues/112) 248 | 249 | **Merged pull requests:** 250 | 251 | - test: adjust ansible test matrix [\#136](https://github.com/patrickjahns/ansible-role-promtail/pull/136) ([patrickjahns](https://github.com/patrickjahns)) 252 | - ci: run in cgroups mode host - fixes systemd issues [\#133](https://github.com/patrickjahns/ansible-role-promtail/pull/133) ([patrickjahns](https://github.com/patrickjahns)) 253 | - chore\(deps\): update dependency setuptools to v65 [\#127](https://github.com/patrickjahns/ansible-role-promtail/pull/127) ([renovate[bot]](https://github.com/apps/renovate)) 254 | - chore\(deps\): update dependency molecule to v4.0.1 [\#123](https://github.com/patrickjahns/ansible-role-promtail/pull/123) ([renovate[bot]](https://github.com/apps/renovate)) 255 | - fix: delegate fetching of version information to localhost [\#122](https://github.com/patrickjahns/ansible-role-promtail/pull/122) ([patrickjahns](https://github.com/patrickjahns)) 256 | 257 | ## [1.18.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.18.0) (2022-07-19) 258 | 259 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.17.0...1.18.0) 260 | 261 | **Implemented enhancements:** 262 | 263 | - Add variable promtail\_systemd\_service\_template\_file for systemd service template file [\#117](https://github.com/patrickjahns/ansible-role-promtail/pull/117) ([ni-mkougioumtzian](https://github.com/ni-mkougioumtzian)) 264 | 265 | **Merged pull requests:** 266 | 267 | - chore\(deps\): update dependency grafana/loki to v2.6.1 [\#120](https://github.com/patrickjahns/ansible-role-promtail/pull/120) ([renovate[bot]](https://github.com/apps/renovate)) 268 | - chore\(deps\): update dependency molecule-docker to v2 [\#119](https://github.com/patrickjahns/ansible-role-promtail/pull/119) ([renovate[bot]](https://github.com/apps/renovate)) 269 | - chore\(deps\): update dependency setuptools to v63.2.0 [\#118](https://github.com/patrickjahns/ansible-role-promtail/pull/118) ([renovate[bot]](https://github.com/apps/renovate)) 270 | 271 | ## [1.17.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.17.0) (2022-07-08) 272 | 273 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.16.0...1.17.0) 274 | 275 | **Closed issues:** 276 | 277 | - Support pipeline\_stages [\#105](https://github.com/patrickjahns/ansible-role-promtail/issues/105) 278 | 279 | **Merged pull requests:** 280 | 281 | - chore\(deps\): update dependency grafana/loki to v2.6.0 [\#115](https://github.com/patrickjahns/ansible-role-promtail/pull/115) ([renovate[bot]](https://github.com/apps/renovate)) 282 | - chore\(deps\): update dependency setuptools to v63 [\#114](https://github.com/patrickjahns/ansible-role-promtail/pull/114) ([renovate[bot]](https://github.com/apps/renovate)) 283 | - chore\(deps\): update dependency setuptools to v62.6.0 [\#111](https://github.com/patrickjahns/ansible-role-promtail/pull/111) ([renovate[bot]](https://github.com/apps/renovate)) 284 | - chore\(deps\): update dependency molecule to v4 [\#110](https://github.com/patrickjahns/ansible-role-promtail/pull/110) ([renovate[bot]](https://github.com/apps/renovate)) 285 | - chore\(deps\): update actions/setup-python action to v4 [\#109](https://github.com/patrickjahns/ansible-role-promtail/pull/109) ([renovate[bot]](https://github.com/apps/renovate)) 286 | - chore\(deps\): update robertdebock/galaxy-action action to v1.2.1 [\#107](https://github.com/patrickjahns/ansible-role-promtail/pull/107) ([renovate[bot]](https://github.com/apps/renovate)) 287 | - chore\(deps\): update dependency setuptools to v62.5.0 [\#106](https://github.com/patrickjahns/ansible-role-promtail/pull/106) ([renovate[bot]](https://github.com/apps/renovate)) 288 | 289 | ## [1.16.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.16.0) (2022-04-11) 290 | 291 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.15.0...1.16.0) 292 | 293 | **Implemented enhancements:** 294 | 295 | - Add upstream sync script [\#4](https://github.com/patrickjahns/ansible-role-promtail/issues/4) 296 | - chore\(deps\): update dependency grafana/loki to v2.5.0 [\#103](https://github.com/patrickjahns/ansible-role-promtail/pull/103) ([renovate[bot]](https://github.com/apps/renovate)) 297 | 298 | **Merged pull requests:** 299 | 300 | - chore\(deps\): update dependency setuptools to v62 [\#102](https://github.com/patrickjahns/ansible-role-promtail/pull/102) ([renovate[bot]](https://github.com/apps/renovate)) 301 | - chore\(deps\): update robertdebock/galaxy-action action to v1.2.0 [\#100](https://github.com/patrickjahns/ansible-role-promtail/pull/100) ([renovate[bot]](https://github.com/apps/renovate)) 302 | - chore\(deps\): update dependency setuptools to v61 [\#99](https://github.com/patrickjahns/ansible-role-promtail/pull/99) ([renovate[bot]](https://github.com/apps/renovate)) 303 | - chore\(deps\): update actions/checkout action to v3 [\#98](https://github.com/patrickjahns/ansible-role-promtail/pull/98) ([renovate[bot]](https://github.com/apps/renovate)) 304 | - chore\(deps\): update actions/setup-python action to v3 [\#97](https://github.com/patrickjahns/ansible-role-promtail/pull/97) ([renovate[bot]](https://github.com/apps/renovate)) 305 | - chore\(deps\): update dependency molecule to v3.6.1 [\#95](https://github.com/patrickjahns/ansible-role-promtail/pull/95) ([renovate[bot]](https://github.com/apps/renovate)) 306 | - chore\(deps\): update dependency setuptools to v60.9.2 [\#94](https://github.com/patrickjahns/ansible-role-promtail/pull/94) ([renovate[bot]](https://github.com/apps/renovate)) 307 | - chore\(deps\): update dependency molecule to v3.6.0 [\#93](https://github.com/patrickjahns/ansible-role-promtail/pull/93) ([renovate[bot]](https://github.com/apps/renovate)) 308 | - chore\(deps\): update dependency setuptools to v60.8.1 [\#92](https://github.com/patrickjahns/ansible-role-promtail/pull/92) ([renovate[bot]](https://github.com/apps/renovate)) 309 | - chore\(deps\): update dependency setuptools to v60.6.0 [\#91](https://github.com/patrickjahns/ansible-role-promtail/pull/91) ([renovate[bot]](https://github.com/apps/renovate)) 310 | - chore\(deps\): update dependency setuptools to v60 [\#88](https://github.com/patrickjahns/ansible-role-promtail/pull/88) ([renovate[bot]](https://github.com/apps/renovate)) 311 | - chore\(deps\): update dependency setuptools to v58.5.3 [\#87](https://github.com/patrickjahns/ansible-role-promtail/pull/87) ([renovate[bot]](https://github.com/apps/renovate)) 312 | - chore\(deps\): update robertdebock/galaxy-action action to v1.1.1 [\#83](https://github.com/patrickjahns/ansible-role-promtail/pull/83) ([renovate[bot]](https://github.com/apps/renovate)) 313 | - chore\(deps\): pin dependencies [\#82](https://github.com/patrickjahns/ansible-role-promtail/pull/82) ([renovate[bot]](https://github.com/apps/renovate)) 314 | - chore: add renovate config [\#80](https://github.com/patrickjahns/ansible-role-promtail/pull/80) ([MindTooth](https://github.com/MindTooth)) 315 | 316 | ## [1.15.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.15.0) (2022-01-13) 317 | 318 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.14.0...1.15.0) 319 | 320 | **Implemented enhancements:** 321 | 322 | - Add promtail\_systemd\_service variable \(needed to configure multiple promtail instances\). [\#73](https://github.com/patrickjahns/ansible-role-promtail/pull/73) ([aberes](https://github.com/aberes)) 323 | 324 | **Merged pull requests:** 325 | 326 | - Remove deprecated `include` [\#78](https://github.com/patrickjahns/ansible-role-promtail/pull/78) ([Lithimlin](https://github.com/Lithimlin)) 327 | - chore: update to promtail 2.4.2 [\#77](https://github.com/patrickjahns/ansible-role-promtail/pull/77) ([patrickjahns](https://github.com/patrickjahns)) 328 | 329 | ## [1.14.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.14.0) (2021-12-28) 330 | 331 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.13.1...1.14.0) 332 | 333 | **Implemented enhancements:** 334 | 335 | - Allow for custom checksum [\#72](https://github.com/patrickjahns/ansible-role-promtail/pull/72) ([Cyb3r-Jak3](https://github.com/Cyb3r-Jak3)) 336 | 337 | **Closed issues:** 338 | 339 | - Ability to disable checksum check [\#71](https://github.com/patrickjahns/ansible-role-promtail/issues/71) 340 | 341 | 342 | ## [1.13.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.13.1) (2021-11-28) 343 | 344 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.13.0...1.13.1) 345 | 346 | **Closed issues:** 347 | 348 | - Cannot pull latest version [\#65](https://github.com/patrickjahns/ansible-role-promtail/issues/65) 349 | 350 | **Merged pull requests:** 351 | 352 | - \[RELEASE\] 1.13.1 [\#69](https://github.com/patrickjahns/ansible-role-promtail/pull/69) ([github-actions[bot]](https://github.com/apps/github-actions)) 353 | - Update meta and CI to show Debian Bullseye support. [\#68](https://github.com/patrickjahns/ansible-role-promtail/pull/68) ([twoequaldots](https://github.com/twoequaldots)) 354 | 355 | ## [1.13.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.13.1) (2021-11-28) 356 | 357 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.13.0...1.13.1) 358 | 359 | **Closed issues:** 360 | 361 | - Cannot pull latest version [\#65](https://github.com/patrickjahns/ansible-role-promtail/issues/65) 362 | 363 | **Merged pull requests:** 364 | 365 | - Update meta and CI to show Debian Bullseye support. [\#68](https://github.com/patrickjahns/ansible-role-promtail/pull/68) ([twoequaldots](https://github.com/twoequaldots)) 366 | 367 | ## [1.13.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.13.0) (2021-11-10) 368 | 369 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.12.0...1.13.0) 370 | 371 | **Merged pull requests:** 372 | 373 | - chore: bump promtail to 2.4.1 [\#66](https://github.com/patrickjahns/ansible-role-promtail/pull/66) ([patrickjahns](https://github.com/patrickjahns)) 374 | 375 | ## [1.12.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.12.0) (2021-09-10) 376 | 377 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.11.0...1.12.0) 378 | 379 | **Closed issues:** 380 | 381 | - Remove update\_cache or make it optional [\#63](https://github.com/patrickjahns/ansible-role-promtail/issues/63) 382 | - Remove `run\_once: True` in preflight [\#59](https://github.com/patrickjahns/ansible-role-promtail/issues/59) 383 | 384 | **Merged pull requests:** 385 | 386 | - Add possibility to opt out of APT cache updates [\#64](https://github.com/patrickjahns/ansible-role-promtail/pull/64) ([mweinelt](https://github.com/mweinelt)) 387 | - chore: bump promtail to version 2.3.0 [\#60](https://github.com/patrickjahns/ansible-role-promtail/pull/60) ([patrickjahns](https://github.com/patrickjahns)) 388 | 389 | ## [1.11.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.11.0) (2021-04-06) 390 | 391 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.10.0...1.11.0) 392 | 393 | **Implemented enhancements:** 394 | 395 | - chore: bump promtail version to 2.2.1 [\#56](https://github.com/patrickjahns/ansible-role-promtail/pull/56) ([patrickjahns](https://github.com/patrickjahns)) 396 | 397 | **Closed issues:** 398 | 399 | - Version 1.10.0 not available on Galaxy [\#53](https://github.com/patrickjahns/ansible-role-promtail/issues/53) 400 | 401 | ## [1.10.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.10.0) (2021-04-02) 402 | 403 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.9.1...1.10.0) 404 | 405 | **Implemented enhancements:** 406 | 407 | - chore: bump promtail to 2.2.0 [\#51](https://github.com/patrickjahns/ansible-role-promtail/pull/51) ([patrickjahns](https://github.com/patrickjahns)) 408 | 409 | **Fixed bugs:** 410 | 411 | - ci: ensure the release version is properly parsed in the release pipeline [\#54](https://github.com/patrickjahns/ansible-role-promtail/pull/54) ([patrickjahns](https://github.com/patrickjahns)) 412 | 413 | **Merged pull requests:** 414 | 415 | - \[RELEASE\] 1.10.0 [\#52](https://github.com/patrickjahns/ansible-role-promtail/pull/52) ([github-actions[bot]](https://github.com/apps/github-actions)) 416 | 417 | ## [1.10.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.10.0) (2021-03-11) 418 | 419 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.9.1...1.10.0) 420 | 421 | **Implemented enhancements:** 422 | 423 | - chore: bump promtail to 2.2.0 [\#51](https://github.com/patrickjahns/ansible-role-promtail/pull/51) ([patrickjahns](https://github.com/patrickjahns)) 424 | 425 | ## [1.9.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.9.1) (2020-12-30) 426 | 427 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.9.0...1.9.1) 428 | 429 | **Closed issues:** 430 | 431 | - Entry\_parser setting is no longer needed in playbook examples [\#47](https://github.com/patrickjahns/ansible-role-promtail/issues/47) 432 | 433 | **Merged pull requests:** 434 | 435 | - doc: correct links to upstream configuration [\#50](https://github.com/patrickjahns/ansible-role-promtail/pull/50) ([patrickjahns](https://github.com/patrickjahns)) 436 | - Remove entry parser setting from example config [\#48](https://github.com/patrickjahns/ansible-role-promtail/pull/48) ([tideline3d](https://github.com/tideline3d)) 437 | 438 | ## [1.9.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.9.0) (2020-12-26) 439 | 440 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.8.0...1.9.0) 441 | 442 | **Merged pull requests:** 443 | 444 | - chore: bump promtail version to 2.1.0 [\#45](https://github.com/patrickjahns/ansible-role-promtail/pull/45) ([patrickjahns](https://github.com/patrickjahns)) 445 | 446 | ## [1.8.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.8.0) (2020-12-25) 447 | 448 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.7.0...1.8.0) 449 | 450 | **Implemented enhancements:** 451 | 452 | - Make role compatible with RHEL linux distributions [\#8](https://github.com/patrickjahns/ansible-role-promtail/issues/8) 453 | - Feature rhel compatability [\#43](https://github.com/patrickjahns/ansible-role-promtail/pull/43) ([patrickjahns](https://github.com/patrickjahns)) 454 | 455 | **Fixed bugs:** 456 | 457 | - Why is the promtail\_config\_positions empty by default? [\#37](https://github.com/patrickjahns/ansible-role-promtail/issues/37) 458 | 459 | **Closed issues:** 460 | 461 | - Move ansible tests to github actions [\#34](https://github.com/patrickjahns/ansible-role-promtail/issues/34) 462 | 463 | **Merged pull requests:** 464 | 465 | - CI: fix testing by pinning dependencies [\#44](https://github.com/patrickjahns/ansible-role-promtail/pull/44) ([patrickjahns](https://github.com/patrickjahns)) 466 | - doc: improve readme [\#42](https://github.com/patrickjahns/ansible-role-promtail/pull/42) ([patrickjahns](https://github.com/patrickjahns)) 467 | - CI: notify galay on a new release [\#41](https://github.com/patrickjahns/ansible-role-promtail/pull/41) ([patrickjahns](https://github.com/patrickjahns)) 468 | - Fixes / extends configuration of the positions file [\#39](https://github.com/patrickjahns/ansible-role-promtail/pull/39) ([funkyfuture](https://github.com/funkyfuture)) 469 | - ci: move to github actions [\#38](https://github.com/patrickjahns/ansible-role-promtail/pull/38) ([patrickjahns](https://github.com/patrickjahns)) 470 | 471 | ## [1.7.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.7.0) (2020-10-28) 472 | 473 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.6.1...1.7.0) 474 | 475 | **Implemented enhancements:** 476 | 477 | - Chore\(binary\) update promtail to 2.0.0 [\#32](https://github.com/patrickjahns/ansible-role-promtail/pull/32) ([abmurksi](https://github.com/abmurksi)) 478 | 479 | **Merged pull requests:** 480 | 481 | - ci: test with ansible 2.10 [\#36](https://github.com/patrickjahns/ansible-role-promtail/pull/36) ([patrickjahns](https://github.com/patrickjahns)) 482 | - fix: fix tests by including new required molecule-docker dependency [\#33](https://github.com/patrickjahns/ansible-role-promtail/pull/33) ([patrickjahns](https://github.com/patrickjahns)) 483 | 484 | ## [1.6.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.6.1) (2020-09-11) 485 | 486 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.6.0...1.6.1) 487 | 488 | **Merged pull requests:** 489 | 490 | - chore\(binary\): update promtail to 1.6.1 [\#29](https://github.com/patrickjahns/ansible-role-promtail/pull/29) ([abmurksi](https://github.com/abmurksi)) 491 | 492 | ## [1.6.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.6.0) (2020-09-03) 493 | 494 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.5.0...1.6.0) 495 | 496 | **Fixed bugs:** 497 | 498 | - fix: specify provide permissions for file related tasks [\#27](https://github.com/patrickjahns/ansible-role-promtail/pull/27) ([patrickjahns](https://github.com/patrickjahns)) 499 | 500 | **Merged pull requests:** 501 | 502 | - chore\(binary\): update promtail to version 1.6.0 [\#26](https://github.com/patrickjahns/ansible-role-promtail/pull/26) ([secustor](https://github.com/secustor)) 503 | 504 | ## [1.5.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.5.0) (2020-07-29) 505 | 506 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.4.0...1.5.0) 507 | 508 | **Implemented enhancements:** 509 | 510 | - Make role compatible with arm architecture [\#20](https://github.com/patrickjahns/ansible-role-promtail/issues/20) 511 | 512 | **Fixed bugs:** 513 | 514 | - Replace the rest of the hardcoded references to amd64 with {{ go\_arch }} [\#23](https://github.com/patrickjahns/ansible-role-promtail/pull/23) ([mkeesey](https://github.com/mkeesey)) 515 | 516 | ## [1.4.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.4.0) (2020-05-27) 517 | 518 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.3.1...1.4.0) 519 | 520 | **Implemented enhancements:** 521 | 522 | - feat: add support for arm architecture [\#22](https://github.com/patrickjahns/ansible-role-promtail/pull/22) ([patrickjahns](https://github.com/patrickjahns)) 523 | - Promtail 1.5.0 [\#17](https://github.com/patrickjahns/ansible-role-promtail/pull/17) ([patrickjahns](https://github.com/patrickjahns)) 524 | 525 | ## [1.3.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.3.1) (2020-05-26) 526 | 527 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.3.0...1.3.1) 528 | 529 | **Fixed bugs:** 530 | 531 | - fix: raise privileges of restart handler [\#15](https://github.com/patrickjahns/ansible-role-promtail/pull/15) ([terorie](https://github.com/terorie)) 532 | 533 | ## [1.3.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.3.0) (2020-05-10) 534 | 535 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.2.0...1.3.0) 536 | 537 | **Implemented enhancements:** 538 | 539 | - Include canary [\#1](https://github.com/patrickjahns/ansible-role-promtail/issues/1) 540 | - add support for ubuntu disco [\#13](https://github.com/patrickjahns/ansible-role-promtail/pull/13) ([patrickjahns](https://github.com/patrickjahns)) 541 | - Feat add file sd config [\#12](https://github.com/patrickjahns/ansible-role-promtail/pull/12) ([patrickjahns](https://github.com/patrickjahns)) 542 | 543 | ## [1.2.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.2.0) (2020-04-11) 544 | 545 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.1.0...1.2.0) 546 | 547 | **Fixed bugs:** 548 | 549 | - fix: renamed promtail\_config\_scrap\_configs to promtail\_config\_scrape\_configs [\#10](https://github.com/patrickjahns/ansible-role-promtail/pull/10) ([patrickjahns](https://github.com/patrickjahns)) 550 | 551 | **Merged pull requests:** 552 | 553 | - feat: install promtail 1.4.1 by default [\#9](https://github.com/patrickjahns/ansible-role-promtail/pull/9) ([patrickjahns](https://github.com/patrickjahns)) 554 | 555 | ## [1.1.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.1.0) (2020-03-01) 556 | 557 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.0.1...1.1.0) 558 | 559 | **Implemented enhancements:** 560 | 561 | - feat: specify the log level for promtail [\#7](https://github.com/patrickjahns/ansible-role-promtail/pull/7) ([patrickjahns](https://github.com/patrickjahns)) 562 | 563 | **Merged pull requests:** 564 | 565 | - Updated repository settings and added release automation [\#5](https://github.com/patrickjahns/ansible-role-promtail/pull/5) ([patrickjahns](https://github.com/patrickjahns)) 566 | - added ansible-later for more indepth static code analysis [\#3](https://github.com/patrickjahns/ansible-role-promtail/pull/3) ([patrickjahns](https://github.com/patrickjahns)) 567 | 568 | ## [1.0.1](https://github.com/patrickjahns/ansible-role-promtail/tree/1.0.1) (2020-02-09) 569 | 570 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/1.0.0...1.0.1) 571 | 572 | **Fixed bugs:** 573 | 574 | - fix: failing installation on ubuntu1604 [\#2](https://github.com/patrickjahns/ansible-role-promtail/pull/2) ([patrickjahns](https://github.com/patrickjahns)) 575 | 576 | ## [1.0.0](https://github.com/patrickjahns/ansible-role-promtail/tree/1.0.0) (2020-02-08) 577 | 578 | [Full Changelog](https://github.com/patrickjahns/ansible-role-promtail/compare/87a46bd92a106bffd43e000a4579c1a444bfbf2e...1.0.0) 579 | 580 | 581 | 582 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* 583 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Patrick Jahns 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible Role: promtail 2 | 3 | [![Test](https://github.com/patrickjahns/ansible-role-promtail/workflows/Test/badge.svg)](https://github.com/patrickjahns/ansible-role-promtail/actions?query=workflow%3ATest+branch%3Amaster) 4 | [![License](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg)](https://opensource.org/licenses/MIT) 5 | [![Ansible Role](https://img.shields.io/badge/ansible%20role-patrickjahns.promtail-blue.svg)](https://galaxy.ansible.com/patrickjahns/promtail/) 6 | [![GitHub tag](https://img.shields.io/github/tag/patrickjahns/ansible-role-promtail.svg)](https://github.com/patrickjahns/ansible-role-promtail/tags) 7 | 8 | ## Description 9 | 10 | Deploy [promtail](https://github.com/grafana/loki) using ansible. Supports amd64 and arm architectures. 11 | For recent changes, please check the [CHANGELOG](/CHANGELOG.md) or have a look at [github releases](https://github.com/patrickjahns/ansible-role-promtail/releases) 12 | 13 | 14 | ## Requirements 15 | 16 | - Ansible >= 2.7 17 | 18 | ## Role Variables 19 | 20 | All variables which can be overridden are stored in [defaults/main.yml](defaults/main.yml) file as well as in table below. 21 | 22 | | Name | Default Value | Description | 23 | |--------------------------------------------------|------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| 24 | | `promtail_version` | "3.0.0" | promtail package version. Also accepts *latest* as parameter. | 25 | | `promtail_custom_checksum` | "" | Custom checksum for custom build promtail binaries | 26 | | `promtail_binary_local_dir` | "" | Allows to use local packages instead of ones distributed on github. As parameter it takes the path where zip archive of promtail is stored on host on which ansible is ran. | 27 | | `promtail_extra_args` | [] | Allows to set extra arguments to the binary within the systemd service file. | 28 | | `promtail_config_dir` | /etc/promtail | Directory for storing promtail configuration file | 29 | | `promtail_config_expand_env` | "false" | value of promtail [-config.expand-env](https://grafana.com/docs/loki/latest/clients/promtail/configuration/#use-environment-variables-in-the-configuration) option | 30 | | `promtail_config_file_sd_dir` | "{{ promtail_config_dir }}/file_sd" | Default directory for `file_sd` discovery | 31 | | `promtail_config_file` | "{{ promtail_config_dir }}/promtail.yml" | Configuration file used by promtail | 32 | | `promtail_system_user` | promtail | User the promtail process will run at | 33 | | `promtail_system_group` | "{{ promtail_system_user }}" | Group of the *promtail* user | 34 | | `promtail_user_additional_groups` | "adm" | Additional groups to be added to *promtail* user to give access to allow scraping of specific log files | 35 | | `promtail_config_clients` | see [defaults/main.yml](defaults/main.yml) | promtail [clients](https://grafana.com/docs/loki/latest/clients/promtail/configuration/#clientsg) section | 36 | | `promtail_loki_server_url` | http://127.0.0.1:3100 | Server url where promtail will push its result | 37 | | `promtail_config_server` | see [defaults/main.yml](defaults/main.yml) | promtail [server](https://grafana.com/docs/loki/latest/clients/promtail/configuration/#server) section | 38 | | `promtail_positions_directory` | `/var/lib/promtail` | Path to the directory where promtail tracks scraped log positons | 39 | | `promtail_config_positions` | {"filename": "{{ promtail_positions_directory }}/positions.yml"} | promtail [positions](https://grafana.com/docs/loki/latest/clients/promtail/configuration/#positions) section | 40 | | `promtail_config_scrape_configs` | [] | promtail [scrape_configs](https://grafana.com/docs/loki/latest/clients/promtail/configuration/#scrape_configs) section | 41 | | `promtail_target_config` | {} | promtail [target_config](https://grafana.com/docs/loki/latest/clients/promtail/configuration/#target_config) section | 42 | | `promtail_log_level` | "info" | Loglevel of promtail (one of: `debug`,`info`,`warn`,`error` ) | 43 | | `promtail_config_include_default_file_sd_config` | "True" | When set to false, the default `file_sd` will not be provisioned | 44 | | `promtail_apt_update_cache` | "True" | When set to false the role will not update the APT cache on its own | 45 | 46 | For each section (`promtail_config_clients`, `promtail_config_server`,`promtail_config_positions`,`promtail_config_scrape_configs`,`promtail_target_config`) the configuration can be passed accrodingly to the [official promtail configuration](https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md). 47 | The role will converte the ansible vars into the respective yaml configuration for loki. 48 | 49 | ## Example Playbook 50 | 51 | Basic playbook that will assume that loki will be listening at `http://127.0.0.1:3100` and a simple configuration to scrape `/var/log` logs: 52 | 53 | ```yaml 54 | --- 55 | - hosts: all 56 | roles: 57 | - role: patrickjahns.promtail 58 | vars: 59 | promtail_config_scrape_configs: 60 | - job_name: system 61 | static_configs: 62 | - targets: 63 | - localhost 64 | labels: 65 | job: varlogs 66 | __path__: /var/log/*log 67 | ``` 68 | 69 | A more complex example, that overrides server, client, positions configuration and provides a scrap configuration for `/var/log`: 70 | 71 | ```yaml 72 | --- 73 | - hosts: all 74 | roles: 75 | - role: patrickjahns.promtail 76 | vars: 77 | promtail_config_server: 78 | http_listen_port: 9080 79 | grpc_listen_port: 9081 80 | promtail_config_clients: 81 | - url: "http://prometheus.domain.tld:3100/loki/api/v1/push" 82 | external_labels: 83 | host: "{{ ansible_hostname }}" 84 | promtail_config_positions: 85 | filename: "{{ promtail_positions_directory }}/positions.yaml" 86 | sync_period: "60s" 87 | 88 | promtail_config_scrape_configs: 89 | - job_name: system 90 | static_configs: 91 | - targets: 92 | - localhost 93 | labels: 94 | job: varlogs 95 | __path__: /var/log/*log 96 | ``` 97 | 98 | ## Local Testing 99 | 100 | The preferred way of locally testing the role is to use Docker and [molecule](https://github.com/metacloud/molecule) (v3.x). You will have to install Docker on your system. See "Get started" for a Docker package suitable to for your system. 101 | We are using tox to simplify process of testing on multiple ansible versions. To install tox execute: 102 | ```sh 103 | pip3 install tox 104 | ``` 105 | To run tests on all ansible versions (WARNING: this can take some time) 106 | ```sh 107 | tox 108 | ``` 109 | To run a custom molecule command on custom environment with only default test scenario: 110 | ```sh 111 | tox -e ansible29 -- molecule test -s default 112 | ``` 113 | For more information about molecule go to their [docs](http://molecule.readthedocs.io/en/latest/). 114 | 115 | If you would like to run tests on remote docker host just specify `DOCKER_HOST` variable before running tox tests. 116 | 117 | ## CI 118 | 119 | Github actions is used to test and validate this ansible role via [ansible-later](https://github.com/thegeeklab/ansible-later) and [molecule](https://github.com/ansible-community/molecule). 120 | Molecule tests will run with several operation systems as well as ansible version in order to ensure compatability. 121 | 122 | ## License 123 | 124 | This project is licensed under MIT License. See [LICENSE](/LICENSE) for more details. 125 | 126 | ## Maintainers and Contributors 127 | 128 | - [Patrick Jahns](https://github.com/patrickjahns) 129 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | promtail_apt_update_cache: True 3 | promtail_version: "3.0.0" 4 | promtail_dist_url: "https://github.com/grafana/loki/releases/download/v{{ promtail_version }}/promtail-linux-{{ go_arch }}.zip" 5 | promtail_custom_checksum: "" 6 | promtail_config_dir: /etc/promtail 7 | promtail_config_file_sd_dir: "{{ promtail_config_dir }}/file_sd" 8 | promtail_config_file: "{{ promtail_config_dir }}/promtail.yml" 9 | promtail_config_expand_env: False 10 | 11 | promtail_system_user: promtail 12 | promtail_system_group: "{{ promtail_system_user }}" 13 | promtail_user_additional_groups: "adm" 14 | promtail_systemd_service_template_file: service.j2 15 | promtail_systemd_service: promtail 16 | 17 | promtail_extra_args: [] 18 | 19 | promtail_binary_local_dir: "" 20 | promtail_binary_propagate: False 21 | 22 | promtail_install_dir: /opt/promtail 23 | promtail_tmp_dir: /tmp 24 | 25 | promtail_log_level: info 26 | # One of: debug, info, warn, error 27 | 28 | promtail_config_server: 29 | http_listen_port: 9080 30 | 31 | promtail_loki_server_url: http://127.0.0.1:3100 32 | promtail_config_clients: 33 | - url: "{{ promtail_loki_server_url }}/loki/api/v1/push" 34 | 35 | promtail_positions_directory: /var/lib/promtail 36 | promtail_config_positions: 37 | filename: "{{ promtail_positions_directory }}/positions.yml" 38 | 39 | promtail_config_scrape_configs: [] 40 | # promtail_config_scrape_configs: 41 | # - job_name: system 42 | # entry_parser: raw 43 | # static_configs: 44 | # - targets: 45 | # - localhost 46 | # labels: 47 | # job: varlogs 48 | # host: {{ ansible_hostname }} 49 | # __path__: /var/log/*log 50 | 51 | promtail_config_include_default_file_sd_config: True 52 | 53 | promtail_config_default_file_sd_config: 54 | - job_name: file_sd 55 | file_sd_configs: 56 | - files: 57 | - "{{ promtail_config_file_sd_dir }}/*.yml" 58 | - "{{ promtail_config_file_sd_dir }}/*.yaml" 59 | - "{{ promtail_config_file_sd_dir }}/*.json" 60 | 61 | promtail_target_config: {} 62 | # promtail_target_config: 63 | # sync_period: "10s" 64 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Restart promtail 3 | become: True 4 | systemd: 5 | name: "{{ promtail_systemd_service }}" 6 | state: restarted 7 | daemon_reload: True 8 | tags: 9 | - promtail_run 10 | - promtail 11 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | # Standards: 0.1 2 | --- 3 | galaxy_info: 4 | author: Patrick Jahns 5 | description: Deploy (loki) promtail 6 | role_name: promtail 7 | namespace: patrickjahns 8 | company: none 9 | license: MIT 10 | min_ansible_version: 2.7 11 | platforms: 12 | - name: EL 13 | versions: 14 | - 7 15 | - 8 16 | - name: Fedora 17 | versions: 18 | - all 19 | - name: Debian 20 | versions: 21 | - all 22 | - name: Ubuntu 23 | versions: 24 | - all 25 | galaxy_tags: 26 | - promtail 27 | - loki 28 | - logging 29 | - collector 30 | - monitoring 31 | - metrics 32 | - system 33 | - grafana 34 | - prometheus 35 | 36 | dependencies: [] 37 | -------------------------------------------------------------------------------- /molecule/default/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: | 7 | set -e 8 | yamllint . 9 | flake8 10 | 11 | platforms: 12 | - name: instance 13 | image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" 14 | command: ${MOLECULE_DOCKER_COMMAND:-""} 15 | volumes: 16 | - /sys/fs/cgroup:/sys/fs/cgroup:rw 17 | privileged: true 18 | cgroupns_mode: host 19 | pre_build_image: true 20 | 21 | provisioner: 22 | name: ansible 23 | playbooks: 24 | converge: playbook.yml 25 | inventory: 26 | group_vars: 27 | python3: 28 | ansible_python_interpreter: /usr/bin/python3 29 | scenario: 30 | name: default 31 | verifier: 32 | name: testinfra 33 | -------------------------------------------------------------------------------- /molecule/default/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | any_errors_fatal: true 4 | roles: 5 | - ansible-role-promtail 6 | -------------------------------------------------------------------------------- /molecule/default/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: true 5 | tasks: 6 | - name: Ensure that net-tools is available 7 | package: 8 | name: net-tools 9 | state: present 10 | when: ansible_os_family == 'RedHat' -------------------------------------------------------------------------------- /molecule/default/tests/test_default.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pytest 3 | import yaml 4 | import testinfra.utils.ansible_runner 5 | 6 | 7 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 8 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 9 | 10 | 11 | @pytest.fixture() 12 | def AnsibleDefaults(): 13 | with open("./defaults/main.yml", 'r') as stream: 14 | return yaml.full_load(stream) 15 | 16 | 17 | @pytest.mark.parametrize("dir", [ 18 | "/opt/promtail", 19 | "/etc/promtail", 20 | "/etc/promtail/file_sd", 21 | "/var/lib/promtail", 22 | ]) 23 | def test_directories(host, dir): 24 | d = host.file(dir) 25 | assert d.is_directory 26 | assert d.exists 27 | 28 | 29 | @pytest.mark.parametrize("files", [ 30 | "/etc/systemd/system/promtail.service", 31 | "/usr/local/bin/promtail", 32 | "/etc/promtail/promtail.yml" 33 | ]) 34 | def test_files(host, files): 35 | f = host.file(files) 36 | assert f.exists 37 | assert f.is_file 38 | 39 | 40 | def test_user(host): 41 | assert host.group("promtail").exists 42 | assert host.user("promtail").exists 43 | 44 | 45 | def test_service(host): 46 | s = host.service("promtail") 47 | assert s.is_running 48 | 49 | 50 | def test_http_socket(host): 51 | s = host.socket("tcp://0.0.0.0:9080") 52 | assert s.is_listening 53 | 54 | 55 | def test_grpc_socket(host): 56 | s = host.socket("tcp://0.0.0.0:9095") 57 | assert s.is_listening 58 | 59 | 60 | def test_version(host, AnsibleDefaults): 61 | version = os.getenv('PROMTAIL', AnsibleDefaults['promtail_version']) 62 | out = host.run("/usr/local/bin/promtail --version").stdout 63 | assert version in out 64 | assert "promtail" in out 65 | -------------------------------------------------------------------------------- /molecule/download_and_propagate/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: | 7 | set -e 8 | yamllint . 9 | flake8 10 | 11 | platforms: 12 | - name: instance 13 | image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" 14 | command: ${MOLECULE_DOCKER_COMMAND:-""} 15 | volumes: 16 | - /sys/fs/cgroup:/sys/fs/cgroup:rw 17 | privileged: true 18 | cgroupns_mode: host 19 | pre_build_image: true 20 | 21 | provisioner: 22 | name: ansible 23 | playbooks: 24 | converge: playbook.yml 25 | inventory: 26 | group_vars: 27 | python3: 28 | ansible_python_interpreter: /usr/bin/python3 29 | scenario: 30 | name: download_and_propagate 31 | verifier: 32 | name: testinfra 33 | -------------------------------------------------------------------------------- /molecule/download_and_propagate/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | any_errors_fatal: true 4 | #become: true 5 | roles: 6 | - role: ansible-role-promtail 7 | vars: 8 | promtail_binary_propagate: True 9 | -------------------------------------------------------------------------------- /molecule/download_and_propagate/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: true 5 | tasks: 6 | - name: Ensure that net-tools is available 7 | package: 8 | name: net-tools 9 | state: present 10 | when: ansible_os_family == 'RedHat' -------------------------------------------------------------------------------- /molecule/download_and_propagate/tests/conftest.py: -------------------------------------------------------------------------------- 1 | """PyTest Fixtures.""" 2 | from __future__ import absolute_import 3 | 4 | import os 5 | 6 | import pytest 7 | 8 | 9 | def pytest_runtest_setup(item): 10 | """Run tests only when under molecule with testinfra installed.""" 11 | try: 12 | import testinfra 13 | except ImportError: 14 | pytest.skip("Test requires testinfra", allow_module_level=True) 15 | if "MOLECULE_INVENTORY_FILE" in os.environ: 16 | pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 17 | os.environ["MOLECULE_INVENTORY_FILE"] 18 | ).get_hosts("all") 19 | else: 20 | pytest.skip( 21 | "Test should run only from inside molecule.", 22 | allow_module_level=True 23 | ) 24 | -------------------------------------------------------------------------------- /molecule/download_and_propagate/tests/test_download_and_propagate.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pytest 3 | import testinfra.utils.ansible_runner 4 | 5 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 6 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 7 | 8 | 9 | @pytest.mark.parametrize("dir", [ 10 | "/opt/promtail", 11 | "/etc/promtail", 12 | "/etc/promtail/file_sd", 13 | "/var/lib/promtail", 14 | ]) 15 | def test_directories(host, dir): 16 | d = host.file(dir) 17 | assert d.is_directory 18 | assert d.exists 19 | 20 | 21 | @pytest.mark.parametrize("files", [ 22 | "/etc/systemd/system/promtail.service", 23 | "/usr/local/bin/promtail", 24 | "/etc/promtail/promtail.yml" 25 | ]) 26 | def test_files(host, files): 27 | f = host.file(files) 28 | assert f.exists 29 | assert f.is_file 30 | 31 | 32 | def test_user(host): 33 | assert host.group("promtail").exists 34 | assert host.user("promtail").exists 35 | 36 | 37 | def test_service(host): 38 | s = host.service("promtail") 39 | assert s.is_running 40 | 41 | 42 | def test_http_socket(host): 43 | s = host.socket("tcp://0.0.0.0:9080") 44 | assert s.is_listening 45 | 46 | 47 | def test_grpc_socket(host): 48 | s = host.socket("tcp://0.0.0.0:9095") 49 | assert s.is_listening 50 | 51 | 52 | def test_version(host): 53 | result = host.run("/usr/local/bin/promtail --version") 54 | assert result.rc == 0 55 | -------------------------------------------------------------------------------- /molecule/latest/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: | 7 | set -e 8 | yamllint . 9 | flake8 10 | 11 | platforms: 12 | - name: instance 13 | image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" 14 | command: ${MOLECULE_DOCKER_COMMAND:-""} 15 | volumes: 16 | - /sys/fs/cgroup:/sys/fs/cgroup:rw 17 | privileged: true 18 | cgroupns_mode: host 19 | pre_build_image: true 20 | 21 | provisioner: 22 | name: ansible 23 | playbooks: 24 | converge: playbook.yml 25 | inventory: 26 | group_vars: 27 | python3: 28 | ansible_python_interpreter: /usr/bin/python3 29 | scenario: 30 | name: latest 31 | verifier: 32 | name: testinfra 33 | -------------------------------------------------------------------------------- /molecule/latest/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | any_errors_fatal: true 4 | roles: 5 | - role: ansible-role-promtail 6 | vars: 7 | promtail_version: "latest" 8 | -------------------------------------------------------------------------------- /molecule/latest/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: true 5 | tasks: 6 | - name: Ensure that net-tools is available 7 | package: 8 | name: net-tools 9 | state: present 10 | when: ansible_os_family == 'RedHat' 11 | -------------------------------------------------------------------------------- /molecule/latest/tests/test_latest.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pytest 3 | import testinfra.utils.ansible_runner 4 | 5 | 6 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 7 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 8 | 9 | 10 | @pytest.mark.parametrize("dir", [ 11 | "/opt/promtail", 12 | "/etc/promtail", 13 | "/etc/promtail/file_sd", 14 | "/var/lib/promtail", 15 | ]) 16 | def test_directories(host, dir): 17 | d = host.file(dir) 18 | assert d.is_directory 19 | assert d.exists 20 | 21 | 22 | @pytest.mark.parametrize("files", [ 23 | "/etc/systemd/system/promtail.service", 24 | "/usr/local/bin/promtail", 25 | "/etc/promtail/promtail.yml" 26 | ]) 27 | def test_files(host, files): 28 | f = host.file(files) 29 | assert f.exists 30 | assert f.is_file 31 | 32 | 33 | def test_user(host): 34 | assert host.group("promtail").exists 35 | assert host.user("promtail").exists 36 | 37 | 38 | def test_service(host): 39 | s = host.service("promtail") 40 | assert s.is_running 41 | 42 | 43 | def test_http_socket(host): 44 | s = host.socket("tcp://0.0.0.0:9080") 45 | assert s.is_listening 46 | 47 | 48 | def test_grpc_socket(host): 49 | s = host.socket("tcp://0.0.0.0:9095") 50 | assert s.is_listening 51 | 52 | 53 | def test_version(host): 54 | result = host.run("/usr/local/bin/promtail --version") 55 | assert result.rc == 0 56 | -------------------------------------------------------------------------------- /molecule/scenario_with_local_binary_directory/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: | 7 | set -e 8 | yamllint . 9 | flake8 10 | 11 | platforms: 12 | - name: instance 13 | image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" 14 | command: ${MOLECULE_DOCKER_COMMAND:-""} 15 | volumes: 16 | - /sys/fs/cgroup:/sys/fs/cgroup:rw 17 | privileged: true 18 | cgroupns_mode: host 19 | pre_build_image: true 20 | 21 | provisioner: 22 | name: ansible 23 | playbooks: 24 | converge: playbook.yml 25 | inventory: 26 | group_vars: 27 | python3: 28 | ansible_python_interpreter: /usr/bin/python3 29 | scenario: 30 | name: scenario_with_local_binary_directory 31 | verifier: 32 | name: testinfra 33 | -------------------------------------------------------------------------------- /molecule/scenario_with_local_binary_directory/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | any_errors_fatal: true 4 | #become: true 5 | roles: 6 | - role: ansible-role-promtail 7 | vars: 8 | promtail_version: "2.7.3" 9 | promtail_binary_local_dir: "/tmp" 10 | -------------------------------------------------------------------------------- /molecule/scenario_with_local_binary_directory/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: true 5 | vars: 6 | promtail_version: "2.7.3" 7 | promtail_binary_local_dir: "/tmp" 8 | go_arch_map: 9 | x86_64: 'amd64' 10 | aarch64: 'arm64' 11 | armv7l: 'arm' 12 | armv6l: 'arm' 13 | go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}" 14 | 15 | tasks: 16 | - name: Ensure that net-tools is available 17 | package: 18 | name: net-tools 19 | state: present 20 | when: ansible_os_family == 'RedHat' 21 | - name: Download zip archive on controler 22 | get_url: 23 | url: "https://github.com/grafana/loki/releases/download/v{{ promtail_version }}/promtail-linux-{{ go_arch }}.zip" 24 | dest: "/tmp/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 25 | force: True 26 | delegate_to: localhost 27 | -------------------------------------------------------------------------------- /molecule/scenario_with_local_binary_directory/tests/conftest.py: -------------------------------------------------------------------------------- 1 | """PyTest Fixtures.""" 2 | from __future__ import absolute_import 3 | 4 | import os 5 | 6 | import pytest 7 | 8 | 9 | def pytest_runtest_setup(item): 10 | """Run tests only when under molecule with testinfra installed.""" 11 | try: 12 | import testinfra 13 | except ImportError: 14 | pytest.skip("Test requires testinfra", allow_module_level=True) 15 | if "MOLECULE_INVENTORY_FILE" in os.environ: 16 | pytest.testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 17 | os.environ["MOLECULE_INVENTORY_FILE"] 18 | ).get_hosts("all") 19 | else: 20 | pytest.skip( 21 | "Test should run only from inside molecule.", 22 | allow_module_level=True 23 | ) 24 | -------------------------------------------------------------------------------- /molecule/scenario_with_local_binary_directory/tests/test_scenario_with_local_binary_directory.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pytest 3 | import testinfra.utils.ansible_runner 4 | 5 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 6 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 7 | 8 | 9 | @pytest.mark.parametrize("dir", [ 10 | "/opt/promtail", 11 | "/etc/promtail", 12 | "/etc/promtail/file_sd", 13 | "/var/lib/promtail", 14 | ]) 15 | def test_directories(host, dir): 16 | d = host.file(dir) 17 | assert d.is_directory 18 | assert d.exists 19 | 20 | 21 | @pytest.mark.parametrize("files", [ 22 | "/etc/systemd/system/promtail.service", 23 | "/usr/local/bin/promtail", 24 | "/etc/promtail/promtail.yml" 25 | ]) 26 | def test_files(host, files): 27 | f = host.file(files) 28 | assert f.exists 29 | assert f.is_file 30 | 31 | 32 | def test_user(host): 33 | assert host.group("promtail").exists 34 | assert host.user("promtail").exists 35 | 36 | 37 | def test_service(host): 38 | s = host.service("promtail") 39 | assert s.is_running 40 | 41 | 42 | def test_http_socket(host): 43 | s = host.socket("tcp://0.0.0.0:9080") 44 | assert s.is_listening 45 | 46 | 47 | def test_grpc_socket(host): 48 | s = host.socket("tcp://0.0.0.0:9095") 49 | assert s.is_listening 50 | 51 | 52 | def test_version(host): 53 | result = host.run("/usr/local/bin/promtail --version") 54 | assert result.rc == 0 55 | -------------------------------------------------------------------------------- /molecule/upgrade/.gitignore: -------------------------------------------------------------------------------- 1 | roles/ -------------------------------------------------------------------------------- /molecule/upgrade/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: shell 4 | command: git clone https://github.com/patrickjahns/ansible-role-promtail.git molecule/upgrade/roles/ansible-role-promtail-previous 2> /dev/null || (cd "molecule/upgrade/roles/ansible-role-promtail-previous" ; git pull origin master) 5 | 6 | driver: 7 | name: docker 8 | 9 | platforms: 10 | - name: instance 11 | image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" 12 | command: ${MOLECULE_DOCKER_COMMAND:-""} 13 | volumes: 14 | - /sys/fs/cgroup:/sys/fs/cgroup:rw 15 | privileged: true 16 | cgroupns_mode: host 17 | pre_build_image: true 18 | 19 | provisioner: 20 | name: ansible 21 | playbooks: 22 | converge: playbook.yml 23 | inventory: 24 | group_vars: 25 | python3: 26 | ansible_python_interpreter: /usr/bin/python3 27 | scenario: 28 | name: upgrade 29 | test_sequence: 30 | - dependency 31 | - lint 32 | - cleanup 33 | - destroy 34 | - syntax 35 | - create 36 | - prepare 37 | - converge 38 | # skip idempotence tests, as upgrads/changes to the role will always fail idempotency tests 39 | # - idempotence 40 | - side_effect 41 | - verify 42 | - cleanup 43 | - destroy 44 | verifier: 45 | name: testinfra 46 | -------------------------------------------------------------------------------- /molecule/upgrade/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | any_errors_fatal: true 4 | roles: 5 | - role: ansible-role-promtail-previous 6 | - role: ansible-role-promtail 7 | -------------------------------------------------------------------------------- /molecule/upgrade/prepare.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Prepare 3 | hosts: all 4 | gather_facts: true 5 | tasks: 6 | - name: Ensure that net-tools is available 7 | package: 8 | name: net-tools 9 | state: present 10 | when: ansible_os_family == 'RedHat' 11 | -------------------------------------------------------------------------------- /molecule/upgrade/tests/test_upgrade.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pytest 3 | import testinfra.utils.ansible_runner 4 | 5 | 6 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 7 | os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') 8 | 9 | 10 | @pytest.mark.parametrize("dir", [ 11 | "/opt/promtail", 12 | "/etc/promtail", 13 | "/etc/promtail/file_sd", 14 | "/var/lib/promtail", 15 | ]) 16 | def test_directories(host, dir): 17 | d = host.file(dir) 18 | assert d.is_directory 19 | assert d.exists 20 | 21 | 22 | @pytest.mark.parametrize("files", [ 23 | "/etc/systemd/system/promtail.service", 24 | "/usr/local/bin/promtail", 25 | "/etc/promtail/promtail.yml" 26 | ]) 27 | def test_files(host, files): 28 | f = host.file(files) 29 | assert f.exists 30 | assert f.is_file 31 | 32 | 33 | def test_user(host): 34 | assert host.group("promtail").exists 35 | assert host.user("promtail").exists 36 | 37 | 38 | def test_service(host): 39 | s = host.service("promtail") 40 | assert s.is_running 41 | 42 | 43 | def test_http_socket(host): 44 | s = host.socket("tcp://0.0.0.0:9080") 45 | assert s.is_listening 46 | 47 | 48 | def test_grpc_socket(host): 49 | s = host.socket("tcp://0.0.0.0:9095") 50 | assert s.is_listening 51 | 52 | 53 | def test_version(host): 54 | result = host.run("/usr/local/bin/promtail --version") 55 | assert result.rc == 0 56 | -------------------------------------------------------------------------------- /tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Ensure unzip package is available 3 | package: 4 | name: unzip 5 | state: present 6 | update_cache: "{{ promtail_apt_update_cache }}" 7 | 8 | - name: Create promtail group 9 | group: 10 | name: "{{ promtail_system_group }}" 11 | state: present 12 | system: True 13 | when: promtail_system_group != "root" 14 | 15 | - name: Create the promtail user 16 | user: 17 | name: "{{ promtail_system_user }}" 18 | group: "{{ promtail_system_group }}" 19 | groups: "{{ promtail_user_additional_groups }}" 20 | append: True 21 | shell: /usr/sbin/nologin 22 | system: True 23 | createhome: False 24 | when: promtail_system_user != "root" 25 | 26 | - name: Ensure /usr/local/bin exists 27 | file: 28 | path: /usr/local/bin 29 | state: directory 30 | mode: 0755 31 | 32 | - name: Create config directories 33 | file: 34 | path: "{{ item }}" 35 | state: directory 36 | owner: root 37 | group: "{{ promtail_system_group }}" 38 | mode: 0770 39 | loop: 40 | - "{{ promtail_config_dir }}" 41 | - "{{ promtail_config_file_sd_dir }}" 42 | - "{{ promtail_positions_directory }}" 43 | 44 | - name: Create application dirs 45 | file: 46 | path: "{{ item }}" 47 | state: directory 48 | owner: "{{ promtail_system_user }}" 49 | group: "{{ promtail_system_group }}" 50 | mode: 0755 51 | with_items: 52 | - "{{ promtail_install_dir }}" 53 | - "{{ promtail_install_dir }}/{{ promtail_version }}" 54 | 55 | - name: Check promtail binary 56 | stat: 57 | path: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}" 58 | register: promtail_binary 59 | 60 | - name: Download promtail binaries 61 | get_url: 62 | url: "{{ promtail_dist_url }}" 63 | dest: "{{ promtail_tmp_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 64 | force: True 65 | checksum: "{{ promtail_custom_checksum if promtail_custom_checksum else 'sha256:' + __promtail_checksum }}" 66 | when: 67 | - not promtail_binary.stat.exists 68 | - promtail_binary_local_dir | length == 0 69 | - not promtail_binary_propagate 70 | 71 | - name: Propagate locally distributed promtail archive 72 | copy: 73 | src: "{{ promtail_binary_local_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 74 | dest: "{{ promtail_tmp_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 75 | mode: 0755 76 | owner: root 77 | group: root 78 | when: 79 | - not promtail_binary.stat.exists 80 | - promtail_binary_local_dir | length > 0 81 | - not promtail_binary_propagate 82 | 83 | - name: Download promtail binaries to controller node 84 | get_url: 85 | url: "{{ promtail_dist_url }}" 86 | dest: "{{ promtail_tmp_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 87 | force: True 88 | checksum: "{{ promtail_custom_checksum if promtail_custom_checksum else 'sha256:' + __promtail_checksum }}" 89 | delegate_to: localhost 90 | run_once: True 91 | when: promtail_binary_propagate 92 | 93 | - name: Propagate promtail binaries 94 | copy: 95 | src: "{{ promtail_tmp_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 96 | dest: "{{ promtail_tmp_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 97 | mode: 0755 98 | when: promtail_binary_propagate 99 | 100 | - name: Unpack promtail binaries 101 | ignore_errors: "{{ ansible_check_mode }}" 102 | unarchive: 103 | src: "{{ promtail_tmp_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 104 | dest: "{{ promtail_install_dir }}/{{ promtail_version }}" 105 | creates: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}" 106 | mode: 0755 107 | remote_src: True 108 | 109 | - name: Create symlink to latest version 110 | notify: 111 | - Restart promtail 112 | ignore_errors: "{{ ansible_check_mode }}" 113 | file: 114 | state: link 115 | src: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}" 116 | dest: /usr/local/bin/promtail 117 | mode: 0755 118 | 119 | - name: Write config 120 | notify: 121 | - Restart promtail 122 | template: 123 | src: config.j2 124 | dest: "{{ promtail_config_file }}" 125 | owner: root 126 | group: "{{ promtail_system_group }}" 127 | mode: 0644 128 | validate: /usr/local/bin/promtail -config.file %s -check-syntax 129 | 130 | - name: Create systemd service unit 131 | notify: 132 | - Restart promtail 133 | template: 134 | src: "{{ promtail_systemd_service_template_file }}" 135 | dest: "/etc/systemd/system/{{ promtail_systemd_service }}.service" 136 | mode: 0644 137 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - import_tasks: preflight.yml 3 | tags: 4 | - promtail_install 5 | - promtail 6 | 7 | - import_tasks: install.yml 8 | become: True 9 | tags: 10 | - promtail_install 11 | - promtail 12 | 13 | - name: Ensure promtail service is started and enabled 14 | become: True 15 | systemd: 16 | daemon_reload: True 17 | name: "{{ promtail_systemd_service }}" 18 | state: started 19 | enabled: True 20 | tags: 21 | - promtail_run 22 | - promtail 23 | -------------------------------------------------------------------------------- /tasks/preflight.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Assert usage of systemd as an init system 3 | assert: 4 | that: ansible_service_mgr == 'systemd' 5 | msg: "This module only works with systemd" 6 | 7 | - block: 8 | - name: Get latest release 9 | uri: 10 | url: "https://api.github.com/repos/grafana/loki/releases/latest" 11 | method: GET 12 | return_content: True 13 | status_code: 200 14 | body_format: json 15 | validate_certs: False 16 | user: "{{ lookup('env', 'GH_USER') | default(omit) }}" 17 | password: "{{ lookup('env', 'GH_TOKEN') | default(omit) }}" 18 | no_log: "{{ not lookup('env', 'ANSIBLE_DEBUG') | bool }}" 19 | register: _latest_release 20 | until: _latest_release.status == 200 21 | retries: 5 22 | 23 | - name: "Set promtail version to {{ _latest_release.json.tag_name[1:] }}" 24 | set_fact: 25 | promtail_version: "{{ _latest_release.json.tag_name[1:] }}" 26 | when: 27 | - promtail_version == "latest" 28 | delegate_to: localhost 29 | run_once: True 30 | 31 | - block: 32 | - name: Test if zip local archive exists 33 | stat: 34 | path: "{{ promtail_binary_local_dir }}/{{ promtail_version }}_promtail-linux-{{ go_arch }}.zip" 35 | register: promtail_binary_local_archive 36 | delegate_to: localhost 37 | run_once: True 38 | 39 | - name: Assert local binary exists 40 | assert: 41 | that: promtail_binary_local_archive.stat.exists 42 | msg: "When using 'promtail_binary_local_dir' please ensure that the binary exists" 43 | 44 | when: 45 | - promtail_binary_local_dir | length > 0 46 | 47 | - block: 48 | - name: "Get checksum list" 49 | set_fact: 50 | __promtail_checksums: "{{ lookup('url', 'https://github.com/grafana/loki/releases/download/v' + promtail_version + '/SHA256SUMS', wantlist=True) | list }}" 51 | run_once: True 52 | 53 | - name: "Get checksum for {{ go_arch }} architecture" 54 | set_fact: 55 | __promtail_checksum: "{{ item.split(' ')[0] }}" 56 | with_items: "{{ __promtail_checksums }}" 57 | when: 58 | - "('promtail-linux-' + go_arch + '.zip') in item" 59 | when: 60 | - promtail_binary_local_dir | length == 0 61 | -------------------------------------------------------------------------------- /templates/config.j2: -------------------------------------------------------------------------------- 1 | #jinja2: trim_blocks: True, lstrip_blocks: True 2 | {{ ansible_managed | comment }} 3 | # https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md 4 | server: 5 | {{ promtail_config_server | to_nice_yaml(indent=2) | indent(2, False) }} 6 | 7 | {% if promtail_config_positions != {} %} 8 | positions: 9 | {{ promtail_config_positions | to_nice_yaml(indent=2) | indent(2, False) }} 10 | {% endif %} 11 | 12 | clients: 13 | {{ promtail_config_clients | to_nice_yaml(indent=2) | indent(2, False) }} 14 | 15 | scrape_configs: 16 | {% if promtail_config_include_default_file_sd_config | bool %} 17 | {{ promtail_config_default_file_sd_config | to_nice_yaml(indent=2) | indent(2, False) }} 18 | {% endif %} 19 | {% if promtail_config_scrape_configs|length %} 20 | {{ promtail_config_scrape_configs | to_nice_yaml(indent=2, width=2147483647) | indent(2, False) }} 21 | {% endif %} 22 | 23 | {% if promtail_target_config != {} %} 24 | target_config: 25 | {{ promtail_target_config | to_nice_yaml(indent=2) | indent(2, False) }} 26 | {% endif %} -------------------------------------------------------------------------------- /templates/service.j2: -------------------------------------------------------------------------------- 1 | {{ ansible_managed | comment }} 2 | 3 | 4 | [Unit] 5 | Description=promtail 6 | After=network-online.target 7 | 8 | [Service] 9 | Restart=always 10 | RestartSec=5 11 | TimeoutSec=5 12 | User={{ promtail_system_user }} 13 | Group={{ promtail_system_group }} 14 | ExecStart=/usr/local/bin/promtail -config.file={{ promtail_config_file }} -log.level={{ promtail_log_level }} -config.expand-env={{ promtail_config_expand_env | lower }} {{ promtail_extra_args | join(' ') }} 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | docker 2 | molecule==4.0.4 3 | molecule-docker==2.1.0 4 | ansible-compat<=4.0.0 5 | pytest-testinfra 6 | flake8 7 | setuptools==69.2.0 -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | minversion = 1.8 3 | envlist = ansible{27,28,29,210,34,410,510,66} 4 | skipsdist = true 5 | 6 | [gh-actions] 7 | python = 8 | 3.10: ansible{28,29,210,34,410,510,66} 9 | 3.11: ansible{28,29,210,34,410,510,66} 10 | 3.12: ansible{28,29,210,34,410,510,66} 11 | 12 | [gh-actions:env] 13 | ANSIBLE= 14 | 2.7: ansible27 15 | 2.8: ansible28 16 | 2.9: ansible29 17 | 2.10: ansible210 18 | 3.4: ansible34 19 | 4.10: ansible410 20 | 5.10: ansible510 21 | 6.7: ansible67 22 | 7.7: ansible77 23 | 8.7: ansible87 24 | 9.4: ansible94 25 | 26 | [testenv] 27 | passenv = GH_*, DOCKER_HOST, MOLECULE_*, OBJC_DISABLE_INITIALIZE_FORK_SAFETY 28 | deps = 29 | -rtest-requirements.txt 30 | ansible27: ansible<2.8 31 | ansible28: ansible<2.9 32 | ansible29: ansible<2.10, 33 | ansible210: ansible<2.11 34 | ansible210: ansible-compat<3 35 | ansible34: ansible<3.5 36 | ansible34: ansible-compat<3 37 | ansible410: ansible<4.11 38 | ansible510: ansible<5.11 39 | ansible67: ansible<6.8 40 | ansible77: ansible<7.8 41 | ansible87: ansible<8.8 42 | ansible94: ansible<9.5 43 | commands = 44 | {posargs:molecule test --all --destroy always} -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | go_arch_map: 3 | x86_64: 'amd64' 4 | aarch64: 'arm64' 5 | armv7l: 'arm' 6 | armv6l: 'arm' 7 | 8 | go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}" 9 | --------------------------------------------------------------------------------