<commit_before>heat_template_version: 2013-05-23

description: |
  This is a Heat template to deploy multiple LAMP servers


parameters:

  server_hostname:
    label: Server Name
    description: Hostname to use for setting the server name.
    type: string
    default: web
    constraints:
    - length:
        min: 1
        max: 64
    - allowed_pattern: "^[a-zA-Z][a-zA-Z0-9-]*$"
      description: |
        Must begin with a letter and contain only alphanumeric characters.

  image:
    label: Server Image
    description: Operating system to use for the Linux Server
    type: string
    default: CentOS 6.5 (PVHVM)
    constraints:
    - allowed_values:
      - CentOS 6.5 (PVHVM)
      - Red Hat Enterprise Linux 6.5 (PVHVM)
      - Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
      - Ubuntu 12.04 LTS (Precise Pangolin) (PVHVM)
      - Debian 7 (Wheezy) (PVHVM)
      description: Must be a supported operating system.

  flavor:
    label: Cloud Server flavor
    description: Flavor of Cloud server to use
    type: string
    default: 1 GB Performance
    constraints:
    - allowed_values:
      - 1 GB Performance
      - 2 GB Performance
      - 4 GB Performance
      - 8 GB Performance
      - 15 GB Performance
      - 30 GB Performance
      description: |
        Must be a valid Rackspace Cloud Server flavor for the region you have
        selected to deploy into.

  phpmyadmin_user:
    label: Username
    description: "Username for phpMyAdmin logins."
    type: string
    default: serverinfo
    constraints:
    - allowed_pattern: "^(.){1,16}$"
      description: |
        Must be shorter than 16 characters, this is due to MySQL's maximum
        username length.

  kitchen:
    description: URL for the kitchen to use
    type: string
    default: https://github.com/rillip3/LAMP

  chef_version:
    description: Version of chef client to use
    type: string
    default: 11.12.4

resources:

  ssh_key:
    type: "OS::Nova::KeyPair"
    properties:
      name: { get_param: "OS::stack_id" }
      save_private_key: true

  mysql_root_password:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  mysql_repl_password:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  mysql_debian_password:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  phpmyadmin_pass:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  linux_server:
    type: "Rackspace::Cloud::Server"
    properties:
      name: { get_param: server_hostname }
      flavor: { get_param: flavor }
      image: { get_param: image }
      key_name: { get_resource: ssh_key }
      config_drive: "true"

  linux_setup:
    type: "OS::Heat::ChefSolo"
    depends_on: linux_server
    properties:
      username: root
      private_key: { get_attr: [ssh_key, private_key] }
      host: { get_attr: [linux_server, accessIPv4] }
      kitchen: { get_param: kitchen }
      chef_version: { get_param: chef_version }
      node:
        run_list: ["recipe[apache-prep]",
                   "recipe[mysql-prep::repos]",
                   "recipe[apache2]",
                   "recipe[php5]",
                   "recipe[php5::apache]",
                   "recipe[mysql::server]",
                   "recipe[phpmyadmin]",
                   "recipe[holland::mysqldump]"
                   ]

outputs:
  private_key:
    value: { get_attr: [ssh_key, private_key] }

  server_ip:
    value: { get_attr: [linux_server, accessIPv4] }

  phpmyadmin_password:
    value: { get_attr: [phpmyadmin_pass, value] }
  
  mysql_root_password:
    value: { get_attr: [mysql_root_password, value] }
<commit_msg>add back in the references to the variables we set so chef can use them<commit_after>heat_template_version: 2013-05-23

description: |
  This is a Heat template to deploy multiple LAMP servers


parameters:

  server_hostname:
    label: Server Name
    description: Hostname to use for setting the server name.
    type: string
    default: web
    constraints:
    - length:
        min: 1
        max: 64
    - allowed_pattern: "^[a-zA-Z][a-zA-Z0-9-]*$"
      description: |
        Must begin with a letter and contain only alphanumeric characters.

  image:
    label: Server Image
    description: Operating system to use for the Linux Server
    type: string
    default: CentOS 6.5 (PVHVM)
    constraints:
    - allowed_values:
      - CentOS 6.5 (PVHVM)
      - Red Hat Enterprise Linux 6.5 (PVHVM)
      - Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
      - Ubuntu 12.04 LTS (Precise Pangolin) (PVHVM)
      - Debian 7 (Wheezy) (PVHVM)
      description: Must be a supported operating system.

  flavor:
    label: Cloud Server flavor
    description: Flavor of Cloud server to use
    type: string
    default: 1 GB Performance
    constraints:
    - allowed_values:
      - 1 GB Performance
      - 2 GB Performance
      - 4 GB Performance
      - 8 GB Performance
      - 15 GB Performance
      - 30 GB Performance
      description: |
        Must be a valid Rackspace Cloud Server flavor for the region you have
        selected to deploy into.

  phpmyadmin_user:
    label: Username
    description: "Username for phpMyAdmin logins."
    type: string
    default: serverinfo
    constraints:
    - allowed_pattern: "^(.){1,16}$"
      description: |
        Must be shorter than 16 characters, this is due to MySQL's maximum
        username length.

  kitchen:
    description: URL for the kitchen to use
    type: string
    default: https://github.com/rillip3/LAMP

  chef_version:
    description: Version of chef client to use
    type: string
    default: 11.12.4

resources:

  ssh_key:
    type: "OS::Nova::KeyPair"
    properties:
      name: { get_param: "OS::stack_id" }
      save_private_key: true

  mysql_root_password:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  mysql_repl_password:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  mysql_debian_password:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  phpmyadmin_pass:
    type: "OS::Heat::RandomString"
    properties:
      length: 16
      sequence: lettersdigits

  linux_server:
    type: "Rackspace::Cloud::Server"
    properties:
      name: { get_param: server_hostname }
      flavor: { get_param: flavor }
      image: { get_param: image }
      key_name: { get_resource: ssh_key }
      config_drive: "true"

  linux_setup:
    type: "OS::Heat::ChefSolo"
    depends_on: linux_server
    properties:
      username: root
      private_key: { get_attr: [ssh_key, private_key] }
      host: { get_attr: [linux_server, accessIPv4] }
      kitchen: { get_param: kitchen }
      chef_version: { get_param: chef_version }
      node:
        mysql:
          server_root_password: { get_attr: [mysql_root_password, value] }
          server_repl_password: { get_attr: [mysql_repl_password, value] }
          server_debian_password: { get_attr: [mysql_debian_password, value] }
        phpmyadmin:
            pass: { get_attr: [phpmyadmin_pass, value] }
            user: { get_param: phpmyadmin_user }
        run_list: ["recipe[apache-prep]",
                   "recipe[mysql-prep::repos]",
                   "recipe[apache2]",
                   "recipe[php5]",
                   "recipe[php5::apache]",
                   "recipe[mysql::server]",
                   "recipe[phpmyadmin]",
                   "recipe[holland::mysqldump]"]

outputs:
  private_key:
    value: { get_attr: [ssh_key, private_key] }

  server_ip:
    value: { get_attr: [linux_server, accessIPv4] }

  phpmyadmin_password:
    value: { get_attr: [phpmyadmin_pass, value] }
  
  mysql_root_password:
    value: { get_attr: [mysql_root_password, value] }

{'fraction_non_alphanumeric': 0.0913884007029877, 'fraction_numerical': 0.015315089128797388, 'mean_word_length': 2.4429559204840103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6294170', 'n_tokens_mistral': 2638, 'n_tokens_neox': 2439, 'n_words': 687}