aboutsummaryrefslogtreecommitdiffstats
path: root/terraform/ansible.tf
blob: de6206d48653a76cc9f18efcdad0a857691d219b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
resource "github_repository" "ansible" {
  for_each = { for repo in var.repos : repo.name => repo }

  name         = "ansible-role-${each.value.name}"
  description  = each.value.description
  topics       = each.value.topics
  homepage_url = each.value.homepage_url
  visibility   = each.value.visibility
  archived     = each.value.archived

  has_discussions      = false
  has_issues           = true
  allow_merge_commit   = false
  archive_on_destroy   = true
  vulnerability_alerts = true
}

resource "github_actions_secret" "example_secret" {
  for_each = { for repo in var.repos : repo.name => repo if repo.visibility == "public" }

  repository      = "ansible-role-${each.value.name}"
  secret_name     = "GALAXY_API_KEY"
  plaintext_value = var.galaxy_api_key
}

variable "repos" {
  type = list(object({
    name         = string
    description  = string
    topics       = list(string)
    homepage_url = string
    visibility   = string
    archived     = bool
  }))
  default = [
    {
      name         = "prometheus-target"
      description  = "Ansible role for pushing targets to prometheus instance"
      topics       = ["ansible", "role", "galaxy", "prometheus", "monitoring", "metrics", "prometheus-exporter", "node-exporter"]
      homepage_url = "https://galaxy.ansible.com/kliwniloc/prometheus_target"
      visibility   = "public"
      archived     = false
    },
    {
      name         = "borgbackup"
      description  = "Ansible role for deploying borgbackup on client and server"
      topics       = ["ansible", "role", "galaxy", "backup", "borgbackup"]
      homepage_url = "https://galaxy.ansible.com/kliwniloc/borgbackup"
      visibility   = "private"
      archived     = false
    },
  ]
}